blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
2
247
content_id
stringlengths
40
40
detected_licenses
listlengths
0
57
license_type
stringclasses
2 values
repo_name
stringlengths
4
111
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
58
visit_date
timestamp[ns]date
2015-07-25 18:16:41
2023-09-06 10:45:08
revision_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
committer_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
github_id
int64
3.89k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
25 values
gha_event_created_at
timestamp[ns]date
2012-06-07 00:51:45
2023-09-14 21:58:52
gha_created_at
timestamp[ns]date
2008-03-27 23:40:48
2023-08-24 19:49:39
gha_language
stringclasses
159 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
10.5M
extension
stringclasses
111 values
filename
stringlengths
1
195
text
stringlengths
7
10.5M
92e94c88ffff323bec14ed06c52991188a16e256
711057773e5f77957188378fe1b1bff6fa46945c
/source/bcl_chemistry_atom_environment_two.cpp
c599bd8b3b59cd98b35b102231e86d30cdf73618
[]
no_license
vuoanh/AtomEnvironment
311e13454ad9dc00cc5517ac94514ed95df24c4f
f56ae437b453d3d307312101033a1be2bd002adc
refs/heads/master
2020-12-30T22:44:06.704118
2017-02-01T19:33:53
2017-02-01T19:33:53
80,655,409
0
0
null
null
null
null
UTF-8
C++
false
false
24,147
cpp
bcl_chemistry_atom_environment_two.cpp
// (c) Copyright BCL @ Vanderbilt University 2015 // (c) BCL Homepage: http://www.meilerlab.org/bclcommons // (c) The BCL software is developed by the contributing members of the BCL @ Vanderbilt University // (c) This file is part of the BCL software suite and is made available under license. // (c) To view or modify this file, you must enter into one of the following agreements if you have not done so already: // (c) For academic and non-profit users: // (c) the BCL Academic Single-User License, available at http://www.meilerlab.org/bclcommons/license // (c) For commercial users: // (c) The BCL Commercial Site License, available upon request from bcl-support-commercial@meilerlab.org // (c) For BCL developers at Vanderbilt University: // (c) The BCL Developer Agreement, available at http://www.meilerlab.org/bclcommons/developer_agreement // (c) // (c) As part of all such agreements, this copyright notice must appear, verbatim and without addition, at the // (c) top of all source files of the BCL project and may not be modified by any party except the BCL developers at // (c) Vanderbilt University. // (c) The BCL copyright and license yields to non-BCL copyrights and licenses where indicated by code comments. // (c) Questions about this copyright notice or license agreement may be emailed to bcl-support-academic@meilerlab.org // (c) (for academic users) or bcl-support-commercial@meilerlab.org (for commercial users)/* // include the namespace headers #include "chemistry/bcl_chemistry.h" // include the header of this class #include "chemistry/bcl_chemistry_atom_environment_two.h" #include "util/bcl_util_serializable_interface.h" // includes from bcl - sorted alphabetically #include "chemistry/bcl_chemistry_atom_complete.h" #include "chemistry/bcl_chemistry_fragment_complete.h" //!> input is a fragment complete #include "io/bcl_io_file.h" #include "io/bcl_io_ofstream.h" #include "chemistry/bcl_chemistry_configurational_bond_type_data.h" #include "util/bcl_util_enumerated.h" #include "storage/bcl_storage_triplet.h" #include "util/bcl_util_function_wrapper.h" #include "storage/bcl_storage_map.h" #include "storage/bcl_storage_pair.h" #include "chemistry/bcl_chemistry_atom_vector.h" #include "function/bcl_function_member_unary_const.h" #include "util/bcl_util_string_functions.h" #include "chemistry/bcl_chemistry_conformation_interface.h" #include "sdf/bcl_sdf_bond_info.h" using bcl::sdf::BondInfo; // external includes - sorted alphabetically namespace bcl { namespace chemistry { ////////// // data // ////////// // separate, anonymous namespace to prevent exporting symbols namespace { // add each of the possible instances to the enumerated instances util::ObjectInterface *AddInstances() { // keep a pointer to the last created instance util::ObjectInterface *last_instance( NULL); for( size_t atom_type( 0); atom_type < AtomEnvironment2::s_NumberAtomTypes; ++atom_type) { last_instance = util::Enumerated< util::SerializableInterface>::AddInstance ( new AtomEnvironment2( static_cast< AtomEnvironment2::Atom_type>( atom_type)) ); } return last_instance; } } //single instance of that class const util::SiPtr< const util::ObjectInterface> AtomEnvironment2::s_Instances( AddInstances()); //! @brief Get the name, description, and function of the given atom type //! @param ATOM_TYPE the atom type of interest //! @return the short name or abbreviation for the class const storage::Triplet< std::string, std::string, AtomEnvironment2::t_functions > & AtomEnvironment2::GetAtomTypeInfo( const Atom_type &ATOM_TYPE) { typedef storage::Triplet< std::string, std::string, AtomEnvironment2::t_functions > t_Info; AtomEnvironment2::t_functions elem_function( &chemistry::AtomEnvironment2::ElementHash, &chemistry::AtomEnvironment2::UnElemHash ); AtomEnvironment2::t_functions elem_functionRC( &chemistry::AtomEnvironment2::ElemRCHash, &chemistry::AtomEnvironment2::UnElemRCHash ); AtomEnvironment2::t_functions atom_function( &chemistry::AtomEnvironment2::AtomHash, &chemistry::AtomEnvironment2::UnAtomHash ); AtomEnvironment2::t_functions atom_functionRC( &chemistry::AtomEnvironment2::AtomRCHash, &chemistry::AtomEnvironment2::UnAtomRCHash ); static const t_Info s_info[ s_NumberAtomTypes] = { t_Info( "Element", "Atomic Number and bond orders", elem_function), t_Info( "ElemRC", "Atomic number, bond orders, and whether the atom is in a ring or/and aromatic", elem_functionRC), t_Info( "Atom", "Atomic Number and bond orders", atom_function), t_Info( "AtomRC", "Atomic Number and bond orders", atom_functionRC), }; return s_info[ ATOM_TYPE]; }; //! @brief atom type name as string //! @param ATOM_TYPE the atom type //! @return the string for the measure const std::string &AtomEnvironment2::GetAtomTypeName( const Atom_type &ATOM_TYPE) { return GetAtomTypeInfo( ATOM_TYPE).First(); } ////////////////// // Constructions// ////////////////// //! default constructor AtomEnvironment2::AtomEnvironment2():m_BondNumLimit(2) { } //! constructor with Atom_type specification AtomEnvironment2::AtomEnvironment2( const Atom_type &ATOM_TYPE): m_BondNumLimit(2), m_AtomType( ATOM_TYPE) { } //! constructor from AE string representation AtomEnvironment2::AtomEnvironment2( const Atom_type &ATOM_TYPE, const std::string &STRING): m_BondNumLimit(2), m_AtomType( ATOM_TYPE), m_AtomEnvironment(StringToAE(STRING, ATOM_TYPE)) { } //! @brief constructor for building an atom environment from bond distance limit, index of atom, atom type, and fragment complete AtomEnvironment2::AtomEnvironment2( size_t ATOM_INDEX, const Atom_type &ATOM_TYPE, const ConformationInterface & FRAGMENT): m_AtomIndex( ATOM_INDEX), m_BondNumLimit(2), m_AtomType( ATOM_TYPE), m_AtomEnvironment(m_BondNumLimit + 1, storage::Map< size_t, size_t>()) { t_output s_output(AtomEnvironment2::GetEncodedAtomEnvironment( FRAGMENT)); storage::Vector< std::string > encoded_atom_environment = s_output.First(); storage::Vector< size_t> bond_orders = s_output.Second(); DecodeAtomEnvironment ( encoded_atom_environment, HashMolecule( FRAGMENT, bond_orders), m_BondNumLimit ); } //! copy constructor AtomEnvironment2 *AtomEnvironment2::Clone() const { return new AtomEnvironment2( *this); } //! @brief compares two atom environments bool AtomEnvironment2::operator ==( const AtomEnvironment2 &ATOM) const { return ( m_AtomEnvironment == ATOM.m_AtomEnvironment); } //! @brief compares two atom environments bool AtomEnvironment2::operator <( const AtomEnvironment2 &ATOM) const { return ( m_AtomEnvironment < ATOM.m_AtomEnvironment); } //! @brief compares two atom environments bool AtomEnvironment2::operator !=(const AtomEnvironment2 &ATOM) const { return (m_AtomEnvironment != ATOM.m_AtomEnvironment); } ////////////////////// // input and output // ////////////////////// //! @brief return parameters for member data that are set up from the labels //! @return parameters for member data that are set up from the labels io::Serializer AtomEnvironment2::GetSerializer() const { io::Serializer serializer; serializer.SetClassDescription( GetAtomTypeInfo( m_AtomType).Second()); return serializer; } ////////////////// // data access /// ////////////////// //! @brief returns class name //! @return the class name as const ref std::string const std::string &AtomEnvironment2::GetClassIdentifier() const { return GetStaticClassName(*this); } //! @brief access the atom of interest std::size_t AtomEnvironment2::GetAtomOfInterestIndex() const { return m_AtomIndex; } //! @brief get the atom type that this atom enviroment calculator calculates const AtomEnvironment2::Atom_type &AtomEnvironment2::GetAtomType() const { return m_AtomType; } //! @brief returns the data label //! @return data label as string const std::string &AtomEnvironment2::GetAlias() const { return ( GetAtomTypeInfo( m_AtomType).First() ); } //! @brief returns the atom environment const AtomEnvironment2::t_AtomEnvironment &AtomEnvironment2::GetAtomEnvironment() const { return m_AtomEnvironment; } //! @brief read the fragment complete of the molecule and and the index of the atom of interest, //! and then provide encoded version of the atom environment. //! @param FRAGMENT the fragment complete representing the molecule //! @param BOND_LIMIT the limit number of bond away from the atom of interest AtomEnvironment2::t_output AtomEnvironment2::GetEncodedAtomEnvironment ( const ConformationInterface &FRAGMENT ) { size_t moleculeSize = FRAGMENT.GetSize(); //!> get the number of atoms in the molecule //!> initializes encoded environment with all '0' values storage::Vector< std::string> encoded_atom_environment(m_BondNumLimit + 1, std::string(moleculeSize, '0')); storage::Vector< size_t> bond_orders( moleculeSize, size_t(0)); encoded_atom_environment(0)[ m_AtomIndex ] = '1'; // the atom itself would be the only '1' in the first string // this function will recursively do the rest of work GetEncodedAtomEnvironmentHelper(FRAGMENT, m_AtomIndex, m_BondNumLimit, 1, encoded_atom_environment, bond_orders); AtomEnvironment2::t_output s_output( encoded_atom_environment, bond_orders); return s_output; } //! @brief recursively find the neighbor atoms in the atom environment of the atom of interest and then update //! @param ENCODED_ATOM_ENVIRONMENT the encoded atom enviroment, each string represents a phere, // each character represent absence/presece of the corresponding atom void AtomEnvironment2::GetEncodedAtomEnvironmentHelper ( const ConformationInterface &FRAGMENT, size_t ATOM_INDEX, size_t BOND_LIMIT, size_t BOND_NUM, storage::Vector< std::string> &ENCODED_ATOM_ENVIRONMENT, storage::Vector< size_t> &BOND_ORDERS ) { if (BOND_NUM <= BOND_LIMIT) { const storage::Vector< BondConformational> &bond_vector (FRAGMENT.GetAtomsIterator() + ATOM_INDEX).GetBonds()); for ( storage::Vector<BondConformational>::const_iterator itr = bond_vector.Begin(), itr_end = FRAGMENT.GetBondInfo().End(); itr != itr_end; ++itr ) { if ( itr->IsValid() && ( itr->GetTargetAtom().GetElementType() != GetElementTypes().e_Hydrogen) ) { size_t bond_order(itr->GetBondType()->GetBondData( chemistry::ConfigurationalBondTypeData::e_BondOrder) ); size_t target_atom_index = FRAGMENT.GetAtomIndex( itr->GetTargetAtom()); UpdateEncodedAtomEnvironment( BOND_NUM, target_atom_index, ENCODED_ATOM_ENVIRONMENT, bond_order, BOND_ORDERS); GetEncodedAtomEnvironmentHelper ( FRAGMENT, target_atom_index, BOND_LIMIT, BOND_NUM + 1, ENCODED_ATOM_ENVIRONMENT, BOND_ORDERS ); } } } } //! @brief returns the corresponding character representing the bond order //! @param BOND_ORDER a integer representing the bond order std::string AtomEnvironment2::GetBondOrder(size_t BOND_ORDER) { switch( BOND_ORDER) { case 1: return "-"; case 2: return "="; case 3: return "#"; default: return "_"; } } //! @brief updates the encoded atom environment //! @param TARGET_ATOM_INDEX the index of the target atom, which bond to the atom of interest //! @param ENCODED_ATOM_ENVIRONMENT a vector of string that represents the neighbor atoms in different spheres void AtomEnvironment2::UpdateEncodedAtomEnvironment ( size_t BOND_NUM, size_t TARGET_ATOM_INDEX, storage::Vector< std::string> &ENCODED_ATOM_ENVIRONMENT, size_t BOND_ORDER, storage::Vector< size_t> &BOND_ORDERS ) { if ( ( ENCODED_ATOM_ENVIRONMENT( BOND_NUM)[ TARGET_ATOM_INDEX] != '0') && ( BOND_ORDERS( TARGET_ATOM_INDEX) < BOND_ORDER)) { BOND_ORDERS( TARGET_ATOM_INDEX) = BOND_ORDER; return; } bool update = true; for ( size_t i = 0; i <= BOND_NUM; i++) { if ( ENCODED_ATOM_ENVIRONMENT( i)[ TARGET_ATOM_INDEX] != '0') { update = false; break; } } if ( update) { ENCODED_ATOM_ENVIRONMENT( BOND_NUM)[ TARGET_ATOM_INDEX] = '1'; BOND_ORDERS( TARGET_ATOM_INDEX) = BOND_ORDER; } } //! @brief converts from the encoded atom environment to the normal representation of the atom environment //! @param ENCODED_ATOM_ENVIRONMENT encoded atom environment in term of a vector of string of 0 and 1 //! @param HASHED_MOLECULE is vector of hashed atoms of the molecule void AtomEnvironment2::DecodeAtomEnvironment ( const storage::Vector< std::string >&ENCODED_ATOM_ENVIRONMENT, const storage::Vector< size_t >&HASHED_MOLECULE, size_t BOND_LIMIT ) { size_t size( HASHED_MOLECULE.GetSize()); for( size_t bond_num( 0); bond_num <= BOND_LIMIT; bond_num++) { for( size_t atom_index = 0; atom_index <= size; atom_index++) { if(ENCODED_ATOM_ENVIRONMENT( bond_num)[ atom_index] == '1') { this->AddAtom( HASHED_MOLECULE( atom_index), bond_num); //!> adds the hashed atom into m_AtomEnvironment } } } } //! @brief adds the Key into MAP or increment its count( the value assiated with that key) template< typename K> void AtomEnvironment2::AddToMap( const K &KEY, storage::Map<K, size_t> &MAP) { std::pair< typename storage::Map< K, size_t>::iterator, bool> insert_pair ( MAP.Insert( storage::Pair<K, size_t> (KEY, size_t(1) ) ) ); if( ! ( insert_pair.second ) ) { insert_pair.first->second += 1; } } //! @brief adds the hashed atom into m_AtomEnvironment //! @param HASHED_ATOM //! @param BOND_DISTANCE void AtomEnvironment2::AddAtom( size_t HASHED_ATOM, size_t BOND_DISTANCE) { AddToMap< size_t>( HASHED_ATOM, m_AtomEnvironment( BOND_DISTANCE)); } //////////////////////////////////////// // helper functions for hash functions / //////////////////////////////////////// //! @brief returns the chemical symbol of an element from its atomic number ATOM_NUMBER const std::string &AtomEnvironment2::GetAtomicSymbol( size_t ATOM_NUMBER, bool ATOM_FLAG) { if (ATOM_FLAG) // if this fingerprint uses atom type { AtomType atom( ATOM_NUMBER); return atom.GetName(); } else // if this fingerprint uses element type { ElementType element( ATOM_NUMBER); return element->GetChemicalSymbol(); } } //! @brief return the enum index of the atom type const size_t AtomEnvironment2::GetAtomTypeIndex( const AtomConformationalInterface &ATOM) { return ATOM.GetAtomType()->GetIndex(); } //! @brief return the enum index of the element type //! @param ATOM: the index of the atom of interest const size_t AtomEnvironment2::GetAtomicNumber( const AtomConformationalInterface &ATOM) { return ATOM.GetElementType().GetIndex(); } //! @brief Checks if the atom is in a ring or not //! @return 1 if the atom in a ring, 0 otherwise const size_t AtomEnvironment2::RingOrAromatic( const AtomConformationalInterface &ATOM) { if( ATOM.CountNonValenceBondsWithProperty( ConfigurationalBondTypeData::e_IsAromatic, 1) > 0) { return 2; } if( ATOM.CountNonValenceBondsWithProperty( ConfigurationalBondTypeData::e_IsInRing, 1) > 0) { return 1; } return 0; } //! @brief return the string symbol from the "ring or aromatic" information const std::string AtomEnvironment2::GetRCSymbol( size_t RC) { if (RC == 2) { return ".r"; } if (RC == 1) { return ".c"; } return ""; } /////////////////////////////// // Hash and unhash functions / ////////////////////////////// //! @brief choose the hash function based on the choice of atom type, then hash every atoms of a fragment complete //! @return a number which is a compressed version of the atom type storage::Vector<size_t> AtomEnvironment2::HashMolecule ( const ConformationInterface &FRAGMENT, const storage::Vector< size_t> &BOND_ORDERS ) const { size_t size = FRAGMENT.GetNumberAtoms(); storage::Vector< size_t> hashedAtoms( size, size_t(0)); size_t index(0); for ( iterate::Generic< const AtomConformationalInterface> itr( FRAGMENT.GetAtomsIterator()); itr.NotAtEnd(); ++itr, ++index ) { function::MemberUnaryConst<AtomEnvironment2, const AtomEnvironment2::t_input&, size_t> function( GetAtomTypeInfo( m_AtomType).Third().First()); t_input s_input( *itr, BOND_ORDERS(index) ); hashedAtoms( index) = function( *this, s_input); //!> add the hashed atom into the corresponding array element } return hashedAtoms; } //! @brief unhashes the atom environment into its string representation std::string AtomEnvironment2::UnHash() const { function::MemberUnaryConst<AtomEnvironment2, const size_t&, std::string> function( GetAtomTypeInfo( m_AtomType).Third().Second()); std::ostringstream oss; for ( size_t i = 0; i <= m_BondNumLimit; ++i) { oss << "["; for ( storage::Map< size_t, size_t>::const_iterator itr = m_AtomEnvironment( i).Begin(), itr_end = m_AtomEnvironment( i).End(); itr != itr_end; ++itr) { for ( size_t j = 0; j < itr->second; ++j) { oss << function( *this, itr->first) + " "; } } oss << "]"; } return oss.str(); } //! @brief hashes the Element atom type info of the INPUT size_t AtomEnvironment2::ElementHash( const t_input &INPUT) const { return ( INPUT.Second() << 7) | GetAtomicNumber( INPUT.First() ); } //! @brief hashes the Element atom type info of the INPUT size_t AtomEnvironment2::ElemRCHash( const t_input &INPUT) const { return ( AtomEnvironment2::RingOrAromatic( INPUT.First()) << 9) | ElementHash( INPUT) ; } //! @brief converts the hashed atom into its string representation std::string AtomEnvironment2::UnElemHash( const size_t &HASHEDATOM) const { // need to check the number of bits? std::string symbol( GetAtomicSymbol( HASHEDATOM & 127, false) ); std::string bond_order( GetBondOrder( ( HASHEDATOM >> 7) & 3) ); return ( bond_order + symbol); } //! @brief converts the hashed atom into its string representation std::string AtomEnvironment2::UnElemRCHash(const size_t &HASHEDATOM) const { std::ostringstream oss; oss << UnElemHash( HASHEDATOM) << GetRCSymbol( ( HASHEDATOM >> 9) & 3); return oss.str(); } //! @brief hashes the Element atom type info of the INPUT size_t AtomEnvironment2::AtomHash( const t_input &INPUT) const { return ( INPUT.Second() << 8) | GetAtomTypeIndex( INPUT.First() ); } //! @brief hashes the Element atom type info of the INPUT size_t AtomEnvironment2::AtomRCHash( const t_input &INPUT) const { return ( AtomEnvironment2::RingOrAromatic( INPUT.First()) << 10) | AtomHash( INPUT) ; } //! @brief converts the hashed atom into its string representation std::string AtomEnvironment2::UnAtomHash( const size_t &HASHEDATOM) const { // need to check the number of bits? std::string symbol( GetAtomicSymbol( HASHEDATOM & 255, true) ); std::string bond_order( GetBondOrder( ( HASHEDATOM >> 8) & 3) ); return ( bond_order + symbol); } //! @brief converts the hashed atom into its string representation std::string AtomEnvironment2::UnAtomRCHash(const size_t &HASHEDATOM) const { std::ostringstream oss; oss << UnAtomHash( HASHEDATOM) << GetRCSymbol( ( HASHEDATOM >> 10) & 3); return oss.str(); } //! @brief converts the hashed string back to the AE AtomEnvironment2::t_AtomEnvironment AtomEnvironment2::StringToAE(const std::string &STRING, const Atom_type ATOM_TYPE) { t_AtomEnvironment AE; storage::Vector< std::string> tokens(util::SplitString(STRING, "[]")); size_t count(0); for ( storage::Vector< std::string>::const_iterator iter = tokens.Begin(); iter != tokens.End(); ++iter, count++) { storage::Vector< std::string> atoms(util::SplitString(*iter, " ")); storage::Map< size_t, size_t> layer; for ( storage::Vector< std::string>::const_iterator itr = atoms.Begin(); itr != atoms.End(); ++itr) { size_t hashed_atom; if (ATOM_TYPE == e_Element) { hashed_atom = ElementStringToAE(*itr); } else if (ATOM_TYPE == e_ElemRC) { hashed_atom = ElemRCStringToAE(*itr); } else if (ATOM_TYPE == e_Atom) { hashed_atom = AtomStringToAE(*itr); } else { hashed_atom = AtomRCStringToAE(*itr); } AddToMap<size_t>( hashed_atom, layer); } AE.PushBack(layer); } return AE; } //! @brief converts the hashed string back to the Element AE size_t AtomEnvironment2::ElementStringToAE(const std::string &STRING) { return CharToBond(STRING[0]) << 7 | StringToElement( STRING.substr( 1, std::string::npos)); } //! @brief converts the hashed string back to the Element AE size_t AtomEnvironment2::ElemRCStringToAE(const std::string &STRING) { storage::Vector< std::string> tokens(util::SplitString(STRING, ".")); return StringToRC(*(tokens[1])) << 9 | ElementStringToAE(*(tokens[0])); } //! @brief converts the hashed string back to the Element AE size_t AtomEnvironment2::AtomStringToAE(const std::string &STRING) { return CharToBond(STRING[0]) << 8 | StringToAtom( STRING.substr(1, std::string::npos)); } //! @brief converts the hashed string back to the Element AE size_t AtomEnvironment2::AtomRCStringToAE(const std::string &STRING) { storage::Vector< std::string> tokens(util::SplitString(STRING, ".")); return StringToRC( *( tokens[1])) << 10 | AtomStringToAE( *( tokens[0])); } //! @brief converts the string back to bond info size_t AtomEnvironment2::CharToBond(const char &CHAR) { if (CHAR == '-') return 1; if (CHAR == '=') return 2; if (CHAR == '#') return 3; return 0; } //! @brief converts the string back to aromatic/cyclic info size_t AtomEnvironment2::StringToRC(const std::string &STRING) { if (STRING == "c") return 1; if (STRING == "r") return 2; return 0; } //! @brief converts the string back to the Element info size_t AtomEnvironment2::StringToElement(const std::string &STRING) { return chemistry::GetElementTypes().ElementTypeLookup(STRING).GetIndex(); } //! @brief converts the string back to the Atom type info size_t AtomEnvironment2::StringToAtom(const std::string &STRING) { return AtomType(STRING).GetIndex(); } } }
33c3f59fef3e7255217047ae7920f6de26a9484b
f37ad61c00cbd2e6f246e4c1574e3577a2bcbec7
/bignumber.h
6d8f34737c0cbdd69314f5ef76a616a6991ea0fd
[]
no_license
ashar-ekram/BigNumber
9ed81031ae8fc116d1f7e03530fc97fa22ab2b3a
6f6534244f6dddce1a4febf54af440d6d991db0f
refs/heads/master
2023-07-01T01:19:37.830413
2021-07-28T05:50:13
2021-07-28T05:50:13
390,229,245
1
0
null
null
null
null
UTF-8
C++
false
false
4,569
h
bignumber.h
// due work: BigInt/BigInt, BigInt%BigInt, pow, sqrt, log, GCD, LCM is still to be written. typedef std:: vector<int> BigInt; BigInt big(std:: string s){ if (s.length() == 0){ return {}; } BigInt res; std:: string temp=""; for(int i=s.length();i%9;i++) temp += "0"; s = temp+s; for (int i=0;i<s.length();i+=9){ int val = 0; for (int j=i;j<i+9;j++){ val = val*10+(s[j]-'0'); } res.insert(res.begin(),val); } return res; } BigInt big(long long num){ std:: string s = ""; while (num > 0){ s += char(num%10+'0'); num /= 10; } reverse(s.begin(),s.end()); return big(s); } BigInt big(int num) { return big((long long) num); } std::istream& operator >> (std:: istream &in, BigInt &a) { std:: string s; getline(std:: cin, s); a = big(s); } std::ostream& operator << (std:: ostream &out, BigInt a){ if(a.size()==0) std:: cout<<"0"; else for(int i=a.size()-1;i>=0;i--) std:: cout<<a[i]; } bool operator < (BigInt a, BigInt b) { //Set(a); //Set(b); if (a.size() != b.size()) return (a.size() < b.size()); for(int i=0;i<a.size();i++) if (a[i] != b[i]) return (a[i] < b[i]); return false; } bool operator > (BigInt a, BigInt b) { return (b < a); } bool operator == (BigInt a, BigInt b) { return !((a < b) || (b < a)); } bool operator <= (BigInt a, BigInt b) { return (a < b and a == b); } bool operator >= (BigInt a, BigInt b) { return (b < a || b == a); } bool operator < (BigInt a, int b) { return (a < big(b)); } bool operator > (BigInt a, int b) { return (a > big(b)); } bool operator == (BigInt a, int b) { return (a == big(b)); } bool operator >= (BigInt a, int b) { return (a >= big(b)); } bool operator <= (BigInt a, int b) { return (a <= big(b)); } BigInt max_big(BigInt a, BigInt b) { if (a > b) return a; return b; } BigInt min_big(BigInt a, BigInt b) { if (a < b) return a; return b; } BigInt operator + (BigInt a, BigInt b) { //Set(a); //Set(b); BigInt ans; int carry = 0,base=1e9; for(int i=0;i<=std:: max(a.size(), b.size())-1;i++) { if (i < a.size()) carry += a[i]; if (i < b.size()) carry += b[i]; ans.push_back(carry%base); carry /= base; } if (carry) ans.push_back(carry); //Set(ans); return ans; } BigInt operator + (BigInt a, int b) { return a + big(b); } void operator ++ (BigInt &a) { // ++a a = a + 1; //return a; } void operator += (BigInt &a, BigInt b) { a = a + b; } void operator += (BigInt &a, int b) { a = a + b; } BigInt operator - (BigInt a, BigInt b) { if(b>a){ BigInt temp; temp=a; a = b; b = temp; } BigInt ans; int carry = 0,base=1e9; for(int i=0;i<a.size();i++) { carry += a[i] - (i < b.size() ? b[i] : 0); if (carry < 0) ans.push_back(carry+base), carry = -1; else ans.push_back(carry), carry = 0; } ans[ans.size()-1] *= -1; return ans; } BigInt operator - (BigInt a, int b) { return a - big(b); } void operator -- (BigInt &a) { // --a a = a - 1; } void operator -= (BigInt &a, BigInt b) { a = a - b; } void operator -= (BigInt &a, int b) { a = a - b; } BigInt operator * (BigInt a, BigInt b) { BigInt ans; ans.resize(a.size()+b.size(), 0); for(int i=0;i<a.size();i++) { long long carry = 0ll; int base = 1e9; for (int j=0;j<b.size() || carry > 0;j++) { long long s = ans[i+j] + carry + (long long)a[i]*(j<b.size()?(long long)b[j]:0ll); ans[i+j] = s%base; carry = s/base; } } while (ans.size() > 1 && ans.back() == 0) ans.pop_back(); return ans; } BigInt operator * (BigInt a, int b) { return a * big(b); } void operator *= (BigInt &a, BigInt b) { a = a * b; } void operator *= (BigInt &a, int b) { a = a * b; } BigInt operator / (BigInt a, int b) { BigInt ans; long long cur = 0ll, base=1e9; for(int i=a.size()-1;i>=0;i--) { cur = (cur*(long long)base + (long long)a[i]); ans.insert(ans.begin(),cur/b); cur %= b; } return ans; } void operator /= (BigInt &a, int b) { a = a / b; } int operator % (BigInt a, int b) { int base = 1e9; if (b == 0) return -1; int ans = 0; for(int i=a.size()-1;i>=0;i--) ans = (ans*(base%b) + a[i]%b)%b; return ans; } int operator %= (BigInt &a, int b) { return a % b; }
7f4abd539128f31a1e12c76772a637456a08ed2c
2309a2aff20265d4d1cd906aa56a840d7f11ddab
/project/src/Common/SmartObject.cpp
274206140369c3d7dba824ad3fa0d919dabda207
[ "MIT" ]
permissive
lirui79/CPProject
c00b4823e629121b0c10d56c9ea5b36c6910d733
e6959850250fd8b96eec46b9ddcd24b1d262bd43
refs/heads/master
2021-01-20T00:20:19.130034
2019-05-09T15:59:32
2019-05-09T15:59:32
89,113,742
0
0
null
2018-05-02T06:56:31
2017-04-23T03:05:51
null
UTF-8
C++
false
false
1,815
cpp
SmartObject.cpp
/*****************************************************/ /* ** Author: lirui ** Date: 2018/03/29 ** File: SmartObject.cpp ** History: ** Copy Right: iris corp ** /*****************************************************/ #include "SmartObject.h" #include "Mutex.h" #include <stdarg.h> #include <signal.h> #include <time.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <string.h> namespace iris { SmartObject::SmartObject() : mRefCount(0) { } SmartObject::~SmartObject() { } int SmartObject::RefCount(int type) { static Mutex mutex ; if (type == 0){ int nRefCount = 0 ; mutex.Lock() ; nRefCount = --mRefCount ; mutex.Unlock() ; print_log("class sub:%s %d\n" , getClassName() , nRefCount); if (nRefCount != 0) return nRefCount ; print_log("class delete:%s %d\n" , getClassName() , nRefCount); delete this ; return nRefCount ; } if (type == 1){ mutex.Lock() ; ++mRefCount ; mutex.Unlock() ; } print_log("class add:%s %d\n" , getClassName() , mRefCount); return mRefCount ; } const char* SmartObject::getClassName() const{ return "SmartObject" ; } void print_log(const char *format , ...) { char szLog[1024]; va_list args ; time_t nowtime = time(0) ; size_t index = strftime(szLog , 64 , "%F %X " , localtime(&nowtime)); va_start(args , format) ; // The last argument to wvsprintf points to the arguments index += vsnprintf(szLog + index , 1024 - index , format , args); // _vsntprintf (szBuf , sizeof (szBuf) , format , pArgList) ; va_end(args) ; printf("%s\n" , szLog) ; } }
7073c0adfb7c3e5d578263358756438d45505b0b
347c5652d64e0d23c346183b1a1643e65b6a392f
/photoshop/ZPhotoshop_Val.cpp
4f936489708526d20f4a3a256ed84c4be5e082d0
[]
no_license
zoolib/zoolib_old
c5762bd14f7b87bbfa8c796de9f10c37ddc8c186
3a5ebbcf86eaaa1100ef89513f71a74922c525bb
refs/heads/master
2021-06-18T20:54:53.007671
2021-03-07T21:43:00
2021-03-07T21:43:00
3,358,019
0
0
null
null
null
null
UTF-8
C++
false
false
34,429
cpp
ZPhotoshop_Val.cpp
/* ------------------------------------------------------------------------------------------------- Copyright (c) 2009 Andrew Green http://www.zoolib.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------------------------------------------------------------------------------------------------- */ #include "zoolib/photoshop/ZPhotoshop_Val.h" #include "zoolib/ZDebug.h" #include "zoolib/ZUnicode.h" #include "ASZStringSuite.h" #include "PITerminology.h" #include "PIUSuites.h" #if ZCONFIG_SPI_Enabled(Carbon64) #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4 #include ZMACINCLUDE3(ApplicationServices,AE,AEObjects.h) #else #include ZMACINCLUDE3(CoreServices,AE,AEObjects.h) #endif #endif #if ZCONFIG_SPI_Enabled(Win) enum { typeSInt32 = typeInteger, typeIEEE64BitFloatingPoint = typeFloat }; #endif using std::swap; // ================================================================================================= // MARK: - Seq and Map Copy, Getter, Setter macros #define COPYFROMTO(SUITE, iSource, iKey, iType, DEST) \ switch (iType) \ { \ case typeSInt32: \ { \ ::int32 theVal; \ if (noErr == SUITE->GetInteger(iSource, iKey, &theVal)) \ SUITE->PutInteger(DEST, theVal); \ break; \ } \ case typeIEEE64BitFloatingPoint: \ { \ double theVal; \ if (noErr == SUITE->GetFloat(iSource, iKey, &theVal)) \ SUITE->PutFloat(DEST, theVal); \ break; \ } \ case typeUnitFloat: \ { \ UnitFloat theVal; \ if (noErr == SUITE->GetUnitFloat(iSource, iKey, &theVal.fUnitID, &theVal.fValue)) \ SUITE->PutUnitFloat(DEST, theVal.fUnitID, theVal.fValue); \ break; \ } \ case typeChar: \ { \ uint32 theLength; \ if (noErr == SUITE->GetStringLength(iSource, iKey, &theLength)) \ { \ string8 theVal(size_t(theLength + 1), ' '); \ if (0 == theLength \ || noErr == SUITE->GetString(iSource, iKey, &theVal[0], theLength + 1)) \ { \ SUITE->PutString(DEST, const_cast<char*>(theVal.c_str())); \ } \ } \ break; \ } \ case typeBoolean: \ { \ Boolean theVal; \ if (noErr == SUITE->GetBoolean(iSource, iKey, &theVal)) \ SUITE->PutBoolean(DEST, theVal); \ break; \ } \ case typeEnumerated: \ { \ Enumerated theVal; \ if (noErr == SUITE->GetEnumerated(iSource, iKey, &theVal.fEnumType, &theVal.fValue)) \ SUITE->PutEnumerated(DEST, theVal.fEnumType, theVal.fValue); \ break; \ } \ case typeObjectSpecifier: \ { \ PIActionReference theVal; \ if (noErr == SUITE->GetReference(iSource, iKey, &theVal)) \ { \ SUITE->PutReference(DEST, theVal); \ /*??spPSActionReference->Free(theVal);*/ \ } \ break; \ } \ case typeValueList: \ { \ PIActionList theVal; \ if (noErr == SUITE->GetList(iSource, iKey, &theVal)) \ { \ theVal = spDuplicate(theVal); \ SUITE->PutList(DEST, theVal); \ } \ break; \ } \ case typeObject: \ { \ DescriptorClassID theDCID; \ PIActionDescriptor theVal; \ if (noErr == SUITE->GetObject(iSource, iKey, &theDCID, &theVal)) \ { \ theVal = spDuplicate(theVal); \ SUITE->PutObject(DEST, theDCID, theVal); \ } \ break; \ } \ /* global object? */ \ case typeClass: \ { \ ZUnimplemented(); \ break; \ } \ /* global class? */ \ case typeAlias: \ case typePath: \ { \ FileRef theVal; \ if (noErr == SUITE->GetAlias(iSource, iKey, &theVal.OParam())) \ SUITE->PutAlias(DEST, theVal.Get()); \ break; \ } \ case typeRawData: \ { \ ::int32 theLength; \ if (noErr == SUITE->GetDataLength(iSource, iKey, &theLength)) \ { \ Data theVal(theLength); \ if (0 == theLength \ || noErr == SUITE->GetData(iSource, iKey, theVal.GetPtrMutable())) \ { \ SUITE->PutData(DEST, theVal.GetSize(), theVal.GetPtrMutable()); \ } \ } \ break; \ } \ } \ #define GETTERCASES(SUITE, P0, P1) \ case typeSInt32: \ { \ ::int32 theVal; \ if (noErr == SUITE->GetInteger(P0, P1, &theVal)) \ { return theVal; } \ break; \ } \ case typeIEEE64BitFloatingPoint: \ { \ double theVal; \ if (noErr == SUITE->GetFloat(P0, P1, &theVal)) \ { return theVal; } \ break; \ } \ case typeUnitFloat: \ { \ UnitFloat theVal; \ if (noErr == SUITE->GetUnitFloat(P0, P1, &theVal.fUnitID, &theVal.fValue)) \ { return theVal; } \ break; \ } \ case typeChar: \ { \ uint32 theLength; \ if (noErr == SUITE->GetStringLength(P0, P1, &theLength)) \ { \ string8 result(size_t(theLength + 1), ' '); \ if (0 == theLength || noErr == SUITE->GetString(P0, P1, &result[0], theLength + 1)) \ return result.substr(0, theLength); \ } \ break; \ } \ case typeBoolean: \ { \ Boolean theVal; \ if (noErr == SUITE->GetBoolean(P0, P1, &theVal)) \ { return bool(theVal); } \ break; \ } \ case typeEnumerated: \ { \ Enumerated theVal; \ if (noErr == SUITE->GetEnumerated(P0, P1, &theVal.fEnumType, &theVal.fValue)) \ { return theVal; } \ break; \ } \ case typeObjectSpecifier: \ { \ PIActionReference theVal; \ if (noErr == SUITE->GetReference(P0, P1, &theVal)) \ return Spec(sAdopt(theVal)); \ break; \ } \ case typeValueList: \ { \ PIActionList theVal; \ if (noErr == SUITE->GetList(P0, P1, &theVal)) \ return Seq(sAdopt(theVal)); \ break; \ } \ case typeObject: \ { \ DescriptorClassID theDCID; \ PIActionDescriptor theVal; \ if (noErr == SUITE->GetObject(P0, P1, &theDCID, &theVal)) \ return Map(theDCID, sAdopt(theVal)); \ break; \ } \ /* global object? */ \ case typeClass: \ { \ ZUnimplemented(); \ break; \ } \ /* global class? */ \ case typeAlias: \ case typePath: \ { \ FileRef theVal; \ if (noErr == SUITE->GetAlias(P0, P1, &theVal.OParam())) \ { return theVal; } \ break; \ } \ case typeRawData: \ { \ ::int32 theLength; \ if (noErr == SUITE->GetDataLength(P0, P1, &theLength)) \ { \ Data result(theLength); \ if (0 == theLength || noErr == SUITE->GetData(P0, P1, result.GetPtrMutable())) \ return result; \ } \ break; \ } \ #define SETTERCASES(SUITE, PARAM) \ if (false) \ {} \ else if (const int32* theVal = iVal.PGet<int32>()) \ { SUITE->PutInteger(PARAM, *theVal); } \ else if (const float* theVal = iVal.PGet<float>()) \ { SUITE->PutFloat(PARAM, *theVal); } \ else if (const UnitFloat* theVal = iVal.PGet<UnitFloat>()) \ { SUITE->PutUnitFloat(PARAM, theVal->fUnitID, theVal->fValue); } \ else if (const string8* theVal = iVal.PGet<string8>()) \ { SUITE->PutString(PARAM, const_cast<char*>(theVal->c_str())); } \ else if (const bool* theVal = iVal.PGet<bool>()) \ { SUITE->PutBoolean(PARAM, *theVal); } \ else if (const Seq* theVal = iVal.PGet<Seq>()) \ { SUITE->PutList(PARAM, theVal->IParam()); } \ else if (const Map* theVal = iVal.PGet<Map>()) \ { SUITE->PutObject(PARAM, theVal->GetType(), theVal->IParam()); } \ /* global object? */ \ else if (const Enumerated* theVal = iVal.PGet<Enumerated>()) \ { SUITE->PutEnumerated(PARAM, theVal->fEnumType, theVal->fValue); } \ else if (const Spec* theVal = iVal.PGet<Spec>()) \ { \ PIActionReference tempRef = theVal->MakeRef(); \ SUITE->PutReference(PARAM, tempRef); \ spPSActionReference->Free(tempRef); \ } \ /*Hmmm else if (const ClassID* theVal = iVal.PGet<ClassID>()) \ { ZUnimplemented(); } Hmm??? SUITE->PutInteger(PARAM, *theVal); } */\ else if (const FileRef* theVal = iVal.PGet<FileRef>()) \ { SUITE->PutAlias(PARAM, theVal->Get()); } \ else if (const Data* theVal = iVal.PGet<Data>()) \ { SUITE->PutData(PARAM, theVal->GetSize(), const_cast<void*>(theVal->GetPtr())); } // ================================================================================================= // MARK: - ZPhotoshop suites, for local use // If we use the symbolic constants for suite version numbers and use a more recent // SDK then we will have an unnecessary runtime error with older host apps. // However, we also compile-time assert that the SDK's constants are sufficiently recent. ZAssertCompile(kPSActionDescriptorSuiteVersion >= 2); ZAssertCompile(kPSActionControlSuiteVersion >= 2); ZAssertCompile(kPSActionReferenceSuiteVersion >= 2); ZAssertCompile(kPSActionListSuiteVersion >= 1); static AutoSuite<PSActionDescriptorProcs> spPSActionDescriptor(kPSActionDescriptorSuite, 2); static AutoSuite<PSActionControlProcs> spPSActionControl(kPSActionControlSuite, 2); static AutoSuite<PSActionReferenceProcs> spPSActionReference(kPSActionReferenceSuite, 2); static AutoSuite<PSActionListProcs> spPSActionList(kPSActionListSuite, 1); static AutoSuite<ASZStringSuite> spASZString(kASZStringSuite, kASZStringSuiteVersion1); // ================================================================================================= // MARK: - Using statements namespace ZooLib { using std::map; using std::pair; // ================================================================================================= // MARK: - Support for ZRef<ASZString> template <> void sRetain_T(struct ASZByteRun*& ioString) { spASZString->AddRef(ioString); } template <> void sRelease_T(struct ASZByteRun* iString) { spASZString->Release(iString); } // ================================================================================================= // MARK: - ZPhotoshop /** Various stuff */ namespace ZPhotoshop { // ================================================================================================= // MARK: - Helpers static PIActionDescriptor spDuplicate(PIActionDescriptor iSource); static PIActionList spDuplicate(PIActionList iSource) { PIActionList theDest; spPSActionList->Make(&theDest); uint32 theCount; if (noErr == spPSActionList->GetCount(iSource, &theCount)) { for (size_t x = 0; x < theCount; ++x) { TypeID theType; if (noErr != spPSActionList->GetType(iSource, x, &theType)) break; //## COPYFROMTO(spPSActionList, iSource, x, theType, theDest) } } return theDest; } static PIActionDescriptor spDuplicate(PIActionDescriptor iSource) { PIActionDescriptor theDest; spPSActionDescriptor->Make(&theDest); uint32 theCount; if (noErr == spPSActionDescriptor->GetCount(iSource, &theCount)) { for (size_t x = 0; x < theCount; ++x) { KeyID theKey; if (noErr != spPSActionDescriptor->GetKey(iSource, x, &theKey)) break; TypeID theType; if (noErr != spPSActionDescriptor->GetType(iSource, theKey, &theType)) break; #define COMMA() , COPYFROMTO(spPSActionDescriptor, iSource, theKey, theType, theDest COMMA() theKey) #undef COMMA } } return theDest; } static string16 spAsString16(const ZRef<ASZString>& iString) { if (size_t theLength = spASZString->LengthAsUnicodeCString(iString)) { string16 result(0, theLength); if (noErr == spASZString->AsUnicodeCString( iString, (ASUnicode*)&result[0], theLength, false)) { return result; } } return string16(); } static ZRef<ASZString> spAsASZString(const string16& iString) { if (size_t theLength = iString.length()) { ZRef<ASZString> result; if (noErr == spASZString->MakeFromUnicode((ASUnicode*)&iString[0], theLength * 2, &result.OParam())) { return result; } } return null; } static TypeID spAsRuntimeTypeID(const string8& iString) { TypeID theTypeID; if (sAsRuntimeTypeID(iString, theTypeID)) return theTypeID; return 0; } static string8 spFromRuntimeTypeID(TypeID iTypeID) { string8 result; if (sFromRuntimeTypeID(iTypeID, result)) return result; return string8(); } static KeyID spAsKeyID(const string8& iName) { return spAsRuntimeTypeID(iName); } static string8 spAsString(KeyID iKeyID) { return spFromRuntimeTypeID(iKeyID); } // ================================================================================================= // MARK: - Public utilities bool sAsRuntimeTypeID(const string8& iString, TypeID& oTypeID) { if (noErr == spPSActionControl->StringIDToTypeID(const_cast<char*>(iString.c_str()), &oTypeID)) return true; return false; } static bool spAppendIfASCII(char iChar, string& ioString) { if (iChar < 32 || iChar > 126) return false; ioString += iChar; return true; } static bool spIntAsString(int32 iInt, string& oString) { oString.clear(); if (!spAppendIfASCII(iInt >> 24, oString)) return false; if (!spAppendIfASCII(iInt >> 16, oString)) return false; if (!spAppendIfASCII(iInt >> 8, oString)) return false; if (!spAppendIfASCII(iInt, oString)) return false; return true; } bool sFromRuntimeTypeID(TypeID iTypeID, string8& oString) { char buf[1024]; if (noErr == spPSActionControl->TypeIDToStringID(iTypeID, buf, sizeof(buf)-1)) { if (buf[0]) { oString = buf; return true; } } return spIntAsString(iTypeID, oString); } // ================================================================================================= // MARK: - ClassID ClassID::ClassID(const string8& iName) : fDCI(spAsRuntimeTypeID(iName)) {} // ================================================================================================= // MARK: - Enumerated Enumerated::Enumerated(EnumTypeID iEnumType, const string8& iValue) : fEnumType(iEnumType) , fValue(spAsRuntimeTypeID(iValue)) {} Enumerated::Enumerated(const string8& iEnumType, EnumID iValue) : fEnumType(spAsRuntimeTypeID(iEnumType)) , fValue(iValue) {} Enumerated::Enumerated(const string8& iEnumType, const string8& iValue) : fEnumType(spAsRuntimeTypeID(iEnumType)) , fValue(spAsRuntimeTypeID(iValue)) {} // ================================================================================================= // MARK: - Spec::Entry Spec::Entry::Entry() : fDCI(0) , fFormID(0) {} Spec::Entry::Entry(const Entry& iOther) { this->pCopyFrom(iOther); } Spec::Entry::~Entry() { this->pRelease(); } Spec::Entry& Spec::Entry::operator=(const Entry& iOther) { if (this != &iOther) { this->pRelease(); this->pCopyFrom(iOther); } return *this; } Spec::Entry Spec::Entry::sClass(ClassID iClassID) { Entry theEntry; theEntry.fDCI = iClassID.GetDCI(); theEntry.fFormID = formClass; return theEntry; } Spec::Entry Spec::Entry::sEnum(ClassID iClassID, const Enumerated& iEnum) { Entry theEntry; theEntry.fDCI = iClassID.GetDCI(); sCtor_T<Enumerated>(theEntry.fData.fBytes, iEnum); theEntry.fFormID = formEnumerated; return theEntry; } Spec::Entry Spec::Entry::sIdentifier(ClassID iClassID, uint32 iIdentifier) { Entry theEntry; theEntry.fDCI = iClassID.GetDCI(); theEntry.fData.fAsIdentifier = iIdentifier; theEntry.fFormID = formIdentifier; return theEntry; } Spec::Entry Spec::Entry::sIndex(ClassID iClassID, uint32 iIndex) { Entry theEntry; theEntry.fDCI = iClassID.GetDCI(); theEntry.fData.fAsIndex = iIndex; theEntry.fFormID = formIndex; return theEntry; } Spec::Entry Spec::Entry::sName(ClassID iClassID, const string8& iName) { Entry theEntry; theEntry.fDCI = iClassID.GetDCI(); sCtor_T<string8>(theEntry.fData.fBytes, iName); theEntry.fFormID = formName; return theEntry; } Spec::Entry Spec::Entry::sName(ClassID iClassID, const ZRef<ASZString>& iName) { Entry theEntry; theEntry.fDCI = iClassID.GetDCI(); string8 theString8 = ZUnicode::sAsUTF8(spAsString16(iName)); sCtor_T<string8>(theEntry.fData.fBytes, theString8); theEntry.fFormID = formName; return theEntry; } Spec::Entry Spec::Entry::sOffset(ClassID iClassID, int32 iOffset) { Entry theEntry; theEntry.fDCI = iClassID.GetDCI(); theEntry.fData.fAsOffset = iOffset; theEntry.fFormID = formOffset; return theEntry; } Spec::Entry Spec::Entry::sProperty(ClassID iClassID, KeyID iKeyID) { Entry theEntry; theEntry.fDCI = iClassID.GetDCI(); theEntry.fData.fAsProperty = iKeyID; theEntry.fFormID = formProperty; return theEntry; } void Spec::Entry::pRelease() { FormID theFormID = fFormID; fFormID = 0; switch (theFormID) { case formClass: case formIdentifier: case formIndex: case formOffset: case formProperty: break; case formEnumerated: { sDtor_T<Enumerated>(fData.fBytes); break; } case formName: { sDtor_T<string8>(fData.fBytes); break; } } } void Spec::Entry::pCopyFrom(const Entry& iOther) { switch (iOther.fFormID) { case formClass: { break; } case formEnumerated: { sCtorFromVoidStar_T<Enumerated>(fData.fBytes, iOther.fData.fBytes); break; } case formIdentifier: { fData.fAsIdentifier = iOther.fData.fAsIdentifier; break; } case formIndex: { fData.fAsIndex = iOther.fData.fAsIndex; break; } case formName: { sCtorFromVoidStar_T<string8>(fData.fBytes, iOther.fData.fBytes); break; } case formOffset: { fData.fAsOffset = iOther.fData.fAsOffset; break; } case formProperty: { fData.fAsProperty = iOther.fData.fAsProperty; break; } } fDCI = iOther.fDCI; fFormID = iOther.fFormID; } // ================================================================================================= // MARK: - Spec /** \class Spec \brief */ Spec Spec::sClass(ClassID iClassID) { return Entry::sClass(iClassID); } Spec Spec::sEnum(ClassID iClassID, const Enumerated& iEnum) { return Entry::sEnum(iClassID, iEnum); } Spec Spec::sIdentifier(ClassID iClassID, uint32 iIdentifier) { return Entry::sIdentifier(iClassID, iIdentifier); } Spec Spec::sIndex(ClassID iClassID, uint32 iIndex) { return Entry::sIndex(iClassID, iIndex); } Spec Spec::sName(ClassID iClassID, const string8& iName) { return Entry::sName(iClassID, iName); } Spec Spec::sName(ClassID iClassID, const ZRef<ASZString>& iName) { return Entry::sName(iClassID, iName); } Spec Spec::sOffset(ClassID iClassID, int32 iOffset) { return Entry::sOffset(iClassID, iOffset); } Spec Spec::sProperty(ClassID iClassID, KeyID iKeyID) { return Entry::sProperty(iClassID, iKeyID); } Spec Spec::sProperty(ClassID iClassID, const string8& iName) { return Entry::sProperty(iClassID, spAsRuntimeTypeID(iName)); } Spec::operator operator_bool() const { return operator_bool_gen::translate(!fEntries.empty()); } void Spec::swap(Spec& iOther) { fEntries.swap(iOther.fEntries); } Spec::Spec() {} Spec::Spec(const Spec& iOther) : fEntries(iOther.fEntries) {} Spec::~Spec() {} Spec& Spec::operator=(const Spec& iOther) { fEntries = iOther.fEntries; return *this; } Spec::Spec(const Entry& iEntry) : fEntries(1, iEntry) {} Spec::Spec(PIActionReference iOther) { spConvert(iOther, fEntries); } Spec::Spec(Adopt_T<PIActionReference> iOther) { spConvert(iOther.Get(), fEntries); } Spec& Spec::operator=(PIActionReference iOther) { vector<Entry> newEntries; spConvert(iOther, newEntries); swap(fEntries, newEntries); return *this; } Spec& Spec::operator=(Adopt_T<PIActionReference> iOther) { vector<Entry> newEntries; spConvert(iOther.Get(), newEntries); swap(fEntries, newEntries); spPSActionReference->Free(iOther.Get()); return *this; } Spec Spec::operator+(const Spec& iOther) { return Spec(*this) += iOther; } Spec& Spec::operator+=(const Spec& iOther) { fEntries.insert(fEntries.end(), iOther.fEntries.begin(), iOther.fEntries.end()); return *this; } const ZQ<Map> Spec::QGet() const { if (PIActionReference theRef = this->MakeRef()) { Map result; OSErr theErr = spPSActionControl->Get(&result.OParam(), theRef); spPSActionReference->Free(theRef); if (noErr == theErr) return result; } return null; } PIActionReference Spec::MakeRef() const { bool allOK = true; PIActionReference theRef = nullptr; if (noErr == spPSActionReference->Make(&theRef)) { for (vector<Entry>::const_reverse_iterator i = fEntries.rbegin(); allOK && i != fEntries.rend(); ++i) { const Entry& theEntry = *i; switch (theEntry.fFormID) { case formClass: { if (noErr != spPSActionReference->PutClass(theRef, theEntry.fDCI)) allOK = false; break; } case formEnumerated: { if (noErr != spPSActionReference->PutEnumerated(theRef, theEntry.fDCI, sFetch_T<Enumerated>(theEntry.fData.fBytes)->fEnumType, sFetch_T<Enumerated>(theEntry.fData.fBytes)->fValue)) { allOK = false; } break; } case formIdentifier: { if (noErr != spPSActionReference->PutIdentifier(theRef, theEntry.fDCI, theEntry.fData.fAsIdentifier)) { allOK = false; } break; } case formIndex: { if (noErr != spPSActionReference->PutIndex(theRef, theEntry.fDCI, theEntry.fData.fAsIndex)) { allOK = false; } break; } case formName: { const string8& theName = *sFetch_T<string8>(theEntry.fData.fBytes); if (noErr != spPSActionReference->PutName(theRef, theEntry.fDCI, const_cast<char*>(theName.c_str()))) { allOK = false; } break; } case formOffset: { if (noErr != spPSActionReference->PutOffset(theRef, theEntry.fDCI, theEntry.fData.fAsOffset)) { allOK = false; } break; } case formProperty: { if (noErr != spPSActionReference->PutProperty(theRef, theEntry.fDCI, theEntry.fData.fAsProperty)) { allOK = false; } break; } } } if (!allOK) { spPSActionReference->Free(theRef); theRef = nullptr; } } return theRef; } void Spec::spConvert(PIActionReference iRef, vector<Entry>& oEntries) { // TODO Check this bool freeRef = false; bool allOK = true; while (iRef && allOK) { FormID theFormID; if (noErr != spPSActionReference->GetForm(iRef, &theFormID)) break; DescriptorClassID theClassID; if (noErr != spPSActionReference->GetDesiredClass(iRef, &theClassID)) break; switch (theFormID) { case formClass: { oEntries.push_back(Entry::sClass(theClassID)); break; } case formEnumerated: { Enumerated theVal; if (noErr != spPSActionReference->GetEnumerated( iRef, &theVal.fEnumType, &theVal.fValue)) { allOK = false; } else { oEntries.push_back(Entry::sEnum(theClassID, theVal)); } break; } case formIdentifier: { uint32 theVal; if (noErr != spPSActionReference->GetIdentifier(iRef, &theVal)) allOK = false; else oEntries.push_back(Entry::sIdentifier(theClassID, theVal)); break; } case formIndex: { uint32 theVal; if (noErr != spPSActionReference->GetIndex(iRef, &theVal)) allOK = false; else oEntries.push_back(Entry::sIndex(theClassID, theVal)); break; } case formName: { #if (kPSActionReferenceSuiteVersion >= 3) ZRef<ASZString> theVal; if (noErr != spPSActionReference->GetNameZString(iRef, &theVal.OParam())) allOK = false; else oEntries.push_back(Entry::sName(theClassID, theVal)); #else uint32 theLength; if (noErr != spPSActionReference->GetNameLength(iRef, &theLength)) { allOK = false; } else { string8 theName(size_t(theLength + 1), ' '); if (noErr != spPSActionReference->GetName(iRef, const_cast<char*>(theName.data()), theLength + 1)) { allOK = false; } else { oEntries.push_back( Entry::sName(theClassID, theName.substr(0, theLength))); } } #endif break; } case formOffset: { ::int32 theVal; if (noErr != spPSActionReference->GetOffset(iRef, &theVal)) allOK = false; else oEntries.push_back(Entry::sOffset(theClassID, theVal)); break; } case formProperty: { KeyID theVal; if (noErr != spPSActionReference->GetProperty(iRef, &theVal)) allOK = false; else oEntries.push_back(Entry::sProperty(theClassID, theVal)); break; } } PIActionReference container; if (noErr != spPSActionReference->GetContainer(iRef, &container)) container = nullptr; if (freeRef) spPSActionReference->Free(iRef); iRef = container; freeRef = true; } } // ================================================================================================= // MARK: - Val /** \class Val \ingroup ZVal \brief A ZVal-compatible entity for use with ZPhotoshop::Map and ZPhotoshop::Seq For simplicity Val is based on ZAny, however ZPhotoshop::Map and ZPhotoshop::Seq have a limited type repertoire which must be respected. */ ZAny Val::AsAny() const { return this->DAsAny(ZAny()); } ZAny Val::DAsAny(const ZAny& iDefault) const { if (const Map* theVal = this->PGet<Map>()) return ZAny(theVal->AsMap_Any(iDefault)); if (const Seq* theVal = this->PGet<Seq>()) return ZAny(theVal->AsSeq_Any(iDefault)); return *this; } Val::Val() {} Val::Val(const Val& iOther) : ZAny((const ZAny&)iOther) {} Val::~Val() {} Val& Val::operator=(const Val& iOther) { ZAny::operator=((const ZAny&)iOther); return *this; } Val::Val(const ZAny& iOther) : ZAny(iOther) {} Val::Val(::int32 iVal) : ZAny(iVal) {} Val::Val(double iVal) : ZAny(iVal) {} Val::Val(bool iVal) : ZAny(iVal) {} Val::Val(const string8& iVal) : ZAny(iVal) {} Val::Val(const Data& iVal) : ZAny(iVal) {} Val::Val(const UnitFloat& iVal) : ZAny(iVal) {} Val::Val(const Enumerated& iVal) : ZAny(iVal) {} Val::Val(const FileRef& iVal) : ZAny(iVal) {} Val::Val(const Seq& iVal) : ZAny(iVal) {} Val::Val(const Map& iVal) : ZAny(iVal) {} Val::Val(const Spec& iVal) : ZAny(iVal) {} // ================================================================================================= // MARK: - Val typename accessors ZMACRO_ZValAccessors_Def_GetSet(Val, Int32, int32) ZMACRO_ZValAccessors_Def_GetSet(Val, Double, double) ZMACRO_ZValAccessors_Def_GetSet(Val, Bool, bool) ZMACRO_ZValAccessors_Def_GetSet(Val, String, string8) ZMACRO_ZValAccessors_Def_GetSet(Val, Data, Data) ZMACRO_ZValAccessors_Def_GetSet(Val, ClassID, ClassID) ZMACRO_ZValAccessors_Def_GetSet(Val, UnitFloat, UnitFloat) ZMACRO_ZValAccessors_Def_GetSet(Val, Enumerated, Enumerated) ZMACRO_ZValAccessors_Def_GetSet(Val, FileRef, FileRef) ZMACRO_ZValAccessors_Def_GetSet(Val, Seq, Seq) ZMACRO_ZValAccessors_Def_GetSet(Val, Map, Map) ZMACRO_ZValAccessors_Def_GetSet(Val, Spec, Spec) // ================================================================================================= // MARK: - Seq /** \class Seq \brief Encapsulates a PIActionList, implementing the ZSeq API. */ ZSeq_Any Seq::AsSeq_Any(const ZAny& iDefault) const { ZSeq_Any theSeq; if (size_t theCount = this->Count()) { for (size_t x = 0; x < theCount; ++x) theSeq.Append(this->Get(x).DAsAny(iDefault)); } return theSeq; } void Seq::swap(Seq& iOther) { swap(fAL, iOther.fAL); } Seq::Seq() { spPSActionList->Make(&fAL); } Seq::Seq(const Seq& iOther) : fAL(spDuplicate(iOther.fAL)) {} Seq::~Seq() { spPSActionList->Free(fAL); } Seq& Seq::operator=(const Seq& iOther) { if (this != &iOther) { spPSActionList->Free(fAL); fAL = spDuplicate(iOther.fAL); } return *this; } Seq::Seq(PIActionList iOther) : fAL(spDuplicate(iOther)) {} Seq::Seq(Adopt_T<PIActionList> iOther) : fAL(iOther.Get()) {} Seq& Seq::operator=(PIActionList iOther) { spPSActionList->Free(fAL); fAL = spDuplicate(iOther); return *this; } Seq& Seq::operator=(Adopt_T<PIActionList> iOther) { spPSActionList->Free(fAL); fAL = iOther.Get(); return *this; } size_t Seq::Count() const { uint32 result; if (noErr == spPSActionList->GetCount(fAL, &result)) return result; return 0; } void Seq::Clear() { spPSActionList->Free(fAL); spPSActionList->Make(&fAL); } const ZQ<Val> Seq::QGet(size_t iIndex) const { if (iIndex < this->Count()) { TypeID theType; if (noErr == spPSActionList->GetType(fAL, iIndex, &theType)) { switch (theType) { GETTERCASES(spPSActionList, fAL, iIndex) default: ZUnimplemented(); } } } return null; } const Val Seq::DGet(const Val& iDefault, size_t iIndex) const { if (ZQ<Val> theQ = this->QGet(iIndex)) return *theQ; return iDefault; } const Val Seq::Get(size_t iIndex) const { return this->DGet(Val(), iIndex); } Seq& Seq::Append(const Val& iVal) { SETTERCASES(spPSActionList, fAL) return *this; } PIActionList& Seq::OParam() { if (fAL) spPSActionList->Free(fAL); fAL = nullptr; return fAL; } PIActionList Seq::IParam() const { return fAL; } PIActionList Seq::Orphan() { PIActionList result = fAL; fAL = nullptr; return result; } // ================================================================================================= // MARK: - Map /** \class Map \brief Encapsulates a PIActionDescriptor, implementing the ZMap API. */ ZMap_Any Map::AsMap_Any(const ZAny& iDefault) const { ZMap_Any theMap; for (Index_t i = this->Begin(), end = this->End(); i != end; ++i) theMap.Set(this->NameOf(i), this->Get(i).DAsAny(iDefault)); return theMap; } void Map::swap(Map& iOther) { swap(fAD, iOther.fAD); } Map::Map() : fType(typeObject) { spPSActionDescriptor->Make(&fAD); } Map::Map(const Map& iOther) : fType(iOther.fType) , fAD(spDuplicate(iOther.fAD)) {} Map::~Map() { if (fAD) spPSActionDescriptor->Free(fAD); } Map& Map::operator=(const Map& iOther) { if (this != &iOther) { spPSActionDescriptor->Free(fAD); fType = iOther.fType; fAD = spDuplicate(iOther.fAD); } return *this; } Map::Map(KeyID iType, const Map& iOther) : fType(iType) , fAD(spDuplicate(iOther.fAD)) {} Map::Map(const string8& iType, const Map& iOther) : fType(spAsKeyID(iType)) , fAD(spDuplicate(iOther.fAD)) {} Map::Map(KeyID iType, PIActionDescriptor iOther) : fType(iType) , fAD(spDuplicate(iOther)) {} Map::Map(const string8& iType, PIActionDescriptor iOther) : fType(spAsKeyID(iType)) , fAD(spDuplicate(iOther)) {} Map::Map(KeyID iType, Adopt_T<PIActionDescriptor> iOther) : fType(iType) , fAD(iOther.Get()) {} Map::Map(const string8& iType, Adopt_T<PIActionDescriptor> iOther) : fType(spAsKeyID(iType)) , fAD(iOther.Get()) {} bool Map::IsEmpty() const { return 0 == this->pCount(); } void Map::Clear() { spPSActionDescriptor->Clear(fAD); } const ZQ<Val> Map::QGet(KeyID iKey) const { if (fAD) { TypeID theType; if (noErr == spPSActionDescriptor->GetType(fAD, iKey, &theType)) { switch (theType) { GETTERCASES(spPSActionDescriptor, fAD, iKey) default: ZUnimplemented(); } } } return null; } const ZQ<Val> Map::QGet(const string8& iName) const { return this->QGet(spAsKeyID(iName)); } const ZQ<Val> Map::QGet(Index_t iIndex) const { return this->QGet(this->KeyOf(iIndex)); } const Val Map::DGet(const Val& iDefault, KeyID iKey) const { if (ZQ<Val> theQ = this->QGet(iKey)) return *theQ; return iDefault; } const Val Map::DGet(const Val& iDefault, const string8& iName) const { if (ZQ<Val> theQ = this->QGet(iName)) return *theQ; return iDefault; } const Val Map::DGet(const Val& iDefault, Index_t iIndex) const { if (ZQ<Val> theQ = this->QGet(iIndex)) return *theQ; return iDefault; } const Val Map::Get(KeyID iKey) const { return this->DGet(Val(), iKey); } const Val Map::Get(const string8& iName) const { return this->DGet(Val(), iName); } const Val Map::Get(Index_t iIndex) const { return this->DGet(Val(), iIndex); } Map& Map::Set(KeyID iKey, const Val& iVal) { #define COMMA() , SETTERCASES(spPSActionDescriptor, fAD COMMA() iKey) #undef COMMA return *this; } Map& Map::Set(const string8& iName, const Val& iVal) { this->Set(spAsKeyID(iName), iVal); return *this; } Map& Map::Set(Index_t iIndex, const Val& iVal) { this->Set(this->KeyOf(iIndex), iVal); return *this; } Map& Map::Erase(KeyID iKey) { spPSActionDescriptor->Erase(fAD, iKey); return *this; } Map& Map::Erase(const string8& iName) { this->Erase(spAsKeyID(iName)); return *this; } Map& Map::Erase(Index_t iIndex) { this->Erase(this->KeyOf(iIndex)); return *this; } PIActionDescriptor& Map::OParam() { if (fAD) spPSActionDescriptor->Free(fAD); fAD = nullptr; return fAD; } PIActionDescriptor Map::IParam() const { return fAD; } Map::Index_t Map::Begin() const { return Index_t(0); } Map::Index_t Map::End() const { return Index_t(this->pCount()); } KeyID Map::KeyOf(Index_t iIndex) const { if (iIndex.Get() < this->pCount()) { KeyID result; if (noErr == spPSActionDescriptor->GetKey(fAD, iIndex.Get(), &result)) return result; } return 0; } string8 Map::NameOf(Index_t iIndex) const { if (KeyID theKey = this->KeyOf(iIndex)) return spAsString(theKey); return string8(); } Map::Index_t Map::IndexOf(KeyID iKey) const { size_t count = this->pCount(); for (size_t x = 0; x < count; ++x) { KeyID theKey; if (noErr == spPSActionDescriptor->GetKey(fAD, x, &theKey)) { if (theKey == iKey) return Index_t(x); } } return Index_t(count); } Map::Index_t Map::IndexOf(const string8& iName) const { return this->IndexOf(spAsKeyID(iName)); } Map::Index_t Map::IndexOf(const Map& iOther, const Index_t& iOtherIndex) const { if (this == &iOther) return iOtherIndex; const KeyID theKey = iOther.KeyOf(iOtherIndex); if (theKey == this->KeyOf(iOtherIndex)) return iOtherIndex; return this->IndexOf(theKey); } KeyID Map::GetType() const { return fType; } PIActionDescriptor Map::Orphan() { PIActionDescriptor result = fAD; fAD = nullptr; return result; } size_t Map::pCount() const { uint32 result; if (noErr == spPSActionDescriptor->GetCount(fAD, &result)) return result; return 0; } } // namespace ZPhotoshop } // namespace ZooLib
93fabfd7d06f7f1b226dc30881862fb311febf4e
fa7474550cac23f55205666e13a99e59c749db97
/vm_tools/sommelier/sommelier-text-input.cc
a8b0b8bd40e8b6a34294c3950bd8463bedde46f5
[ "BSD-3-Clause" ]
permissive
kalyankondapally/chromiumos-platform2
4fe8bac63a95a07ac8afa45088152c2b623b963d
5e5337009a65b1c9aa9e0ea565f567438217e91f
refs/heads/master
2023-01-05T15:25:41.667733
2020-11-08T06:12:01
2020-11-08T07:16:44
295,388,294
0
1
null
null
null
null
UTF-8
C++
false
false
15,445
cc
sommelier-text-input.cc
// Copyright 2018 The Chromium OS Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "sommelier.h" // NOLINT(build/include_directory) #include <assert.h> #include <stdlib.h> #include <string.h> #include "text-input-unstable-v1-client-protocol.h" // NOLINT(build/include_directory) #include "text-input-unstable-v1-server-protocol.h" // NOLINT(build/include_directory) struct sl_host_text_input_manager { struct sl_context* ctx; struct wl_resource* resource; struct zwp_text_input_manager_v1* proxy; }; struct sl_host_text_input { struct sl_context* ctx; struct wl_resource* resource; struct zwp_text_input_v1* proxy; }; static void sl_text_input_activate(struct wl_client* client, struct wl_resource* resource, struct wl_resource* seat, struct wl_resource* surface) { struct sl_host_text_input* host = static_cast<sl_host_text_input*>(wl_resource_get_user_data(resource)); struct sl_host_seat* host_seat = static_cast<sl_host_seat*>(wl_resource_get_user_data(seat)); struct sl_host_surface* host_surface = static_cast<sl_host_surface*>(wl_resource_get_user_data(surface)); zwp_text_input_v1_activate(host->proxy, host_seat->proxy, host_surface->proxy); } // NOLINT(whitespace/indent) static void sl_text_input_deactivate(struct wl_client* client, struct wl_resource* resource, struct wl_resource* seat) { struct sl_host_text_input* host = static_cast<sl_host_text_input*>(wl_resource_get_user_data(resource)); struct sl_host_seat* host_seat = static_cast<sl_host_seat*>(wl_resource_get_user_data(seat)); zwp_text_input_v1_deactivate(host->proxy, host_seat->proxy); } static void sl_text_input_show_input_panel(struct wl_client* client, struct wl_resource* resource) { struct sl_host_text_input* host = static_cast<sl_host_text_input*>(wl_resource_get_user_data(resource)); zwp_text_input_v1_show_input_panel(host->proxy); } static void sl_text_input_hide_input_panel(struct wl_client* client, struct wl_resource* resource) { struct sl_host_text_input* host = static_cast<sl_host_text_input*>(wl_resource_get_user_data(resource)); zwp_text_input_v1_hide_input_panel(host->proxy); } static void sl_text_input_reset(struct wl_client* client, struct wl_resource* resource) { struct sl_host_text_input* host = static_cast<sl_host_text_input*>(wl_resource_get_user_data(resource)); zwp_text_input_v1_reset(host->proxy); } static void sl_text_input_set_surrounding_text(struct wl_client* client, struct wl_resource* resource, const char* text, uint32_t cursor, uint32_t anchor) { struct sl_host_text_input* host = static_cast<sl_host_text_input*>(wl_resource_get_user_data(resource)); zwp_text_input_v1_set_surrounding_text(host->proxy, text, cursor, anchor); } static void sl_text_input_set_content_type(struct wl_client* client, struct wl_resource* resource, uint32_t hint, uint32_t purpose) { struct sl_host_text_input* host = static_cast<sl_host_text_input*>(wl_resource_get_user_data(resource)); zwp_text_input_v1_set_content_type(host->proxy, hint, purpose); } static void sl_text_input_set_cursor_rectangle(struct wl_client* client, struct wl_resource* resource, int32_t x, int32_t y, int32_t width, int32_t height) { struct sl_host_text_input* host = static_cast<sl_host_text_input*>(wl_resource_get_user_data(resource)); zwp_text_input_v1_set_cursor_rectangle(host->proxy, x, y, width, height); } static void sl_text_input_set_preferred_language(struct wl_client* client, struct wl_resource* resource, const char* language) { struct sl_host_text_input* host = static_cast<sl_host_text_input*>(wl_resource_get_user_data(resource)); zwp_text_input_v1_set_preferred_language(host->proxy, language); } static void sl_text_input_commit_state(struct wl_client* client, struct wl_resource* resource, uint32_t serial) { struct sl_host_text_input* host = static_cast<sl_host_text_input*>(wl_resource_get_user_data(resource)); zwp_text_input_v1_commit_state(host->proxy, serial); } static void sl_text_input_invoke_action(struct wl_client* client, struct wl_resource* resource, uint32_t button, uint32_t index) { struct sl_host_text_input* host = static_cast<sl_host_text_input*>(wl_resource_get_user_data(resource)); zwp_text_input_v1_invoke_action(host->proxy, button, index); } static const struct zwp_text_input_v1_interface sl_text_input_implementation = { sl_text_input_activate, sl_text_input_deactivate, sl_text_input_show_input_panel, sl_text_input_hide_input_panel, sl_text_input_reset, sl_text_input_set_surrounding_text, sl_text_input_set_content_type, sl_text_input_set_cursor_rectangle, sl_text_input_set_preferred_language, sl_text_input_commit_state, sl_text_input_invoke_action, }; static void sl_text_input_enter(void* data, struct zwp_text_input_v1* text_input, struct wl_surface* surface) { struct sl_host_text_input* host = static_cast<sl_host_text_input*>( zwp_text_input_v1_get_user_data(text_input)); struct sl_host_surface* host_surface = static_cast<sl_host_surface*>(wl_surface_get_user_data(surface)); zwp_text_input_v1_send_enter(host->resource, host_surface->resource); } static void sl_text_input_leave(void* data, struct zwp_text_input_v1* text_input) { struct sl_host_text_input* host = static_cast<sl_host_text_input*>( zwp_text_input_v1_get_user_data(text_input)); zwp_text_input_v1_send_leave(host->resource); } static void sl_text_input_modifiers_map(void* data, struct zwp_text_input_v1* text_input, struct wl_array* map) { struct sl_host_text_input* host = static_cast<sl_host_text_input*>( zwp_text_input_v1_get_user_data(text_input)); zwp_text_input_v1_send_modifiers_map(host->resource, map); } static void sl_text_input_input_panel_state( void* data, struct zwp_text_input_v1* text_input, uint32_t state) { struct sl_host_text_input* host = static_cast<sl_host_text_input*>( zwp_text_input_v1_get_user_data(text_input)); zwp_text_input_v1_send_input_panel_state(host->resource, state); } static void sl_text_input_preedit_string(void* data, struct zwp_text_input_v1* text_input, uint32_t serial, const char* text, const char* commit) { struct sl_host_text_input* host = static_cast<sl_host_text_input*>( zwp_text_input_v1_get_user_data(text_input)); zwp_text_input_v1_send_preedit_string(host->resource, serial, text, commit); } static void sl_text_input_preedit_styling(void* data, struct zwp_text_input_v1* text_input, uint32_t index, uint32_t length, uint32_t style) { struct sl_host_text_input* host = static_cast<sl_host_text_input*>( zwp_text_input_v1_get_user_data(text_input)); zwp_text_input_v1_send_preedit_styling(host->resource, index, length, style); } static void sl_text_input_preedit_cursor(void* data, struct zwp_text_input_v1* text_input, int32_t index) { struct sl_host_text_input* host = static_cast<sl_host_text_input*>( zwp_text_input_v1_get_user_data(text_input)); zwp_text_input_v1_send_preedit_cursor(host->resource, index); } static void sl_text_input_commit_string(void* data, struct zwp_text_input_v1* text_input, uint32_t serial, const char* text) { struct sl_host_text_input* host = static_cast<sl_host_text_input*>( zwp_text_input_v1_get_user_data(text_input)); zwp_text_input_v1_send_commit_string(host->resource, serial, text); } static void sl_text_input_cursor_position(void* data, struct zwp_text_input_v1* text_input, int32_t index, int32_t anchor) { struct sl_host_text_input* host = static_cast<sl_host_text_input*>( zwp_text_input_v1_get_user_data(text_input)); zwp_text_input_v1_send_cursor_position(host->resource, index, anchor); } static void sl_text_input_delete_surrounding_text( void* data, struct zwp_text_input_v1* text_input, int32_t index, uint32_t length) { struct sl_host_text_input* host = static_cast<sl_host_text_input*>( zwp_text_input_v1_get_user_data(text_input)); zwp_text_input_v1_send_delete_surrounding_text(host->resource, index, length); } static void sl_text_input_keysym(void* data, struct zwp_text_input_v1* text_input, uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) { struct sl_host_text_input* host = static_cast<sl_host_text_input*>( zwp_text_input_v1_get_user_data(text_input)); zwp_text_input_v1_send_keysym(host->resource, serial, time, sym, state, modifiers); } static void sl_text_input_language(void* data, struct zwp_text_input_v1* text_input, uint32_t serial, const char* language) { struct sl_host_text_input* host = static_cast<sl_host_text_input*>( zwp_text_input_v1_get_user_data(text_input)); zwp_text_input_v1_send_language(host->resource, serial, language); } static void sl_text_input_text_direction(void* data, struct zwp_text_input_v1* text_input, uint32_t serial, uint32_t direction) { struct sl_host_text_input* host = static_cast<sl_host_text_input*>( zwp_text_input_v1_get_user_data(text_input)); zwp_text_input_v1_send_text_direction(host->resource, serial, direction); } static const struct zwp_text_input_v1_listener sl_text_input_listener = { sl_text_input_enter, sl_text_input_leave, sl_text_input_modifiers_map, sl_text_input_input_panel_state, sl_text_input_preedit_string, sl_text_input_preedit_styling, sl_text_input_preedit_cursor, sl_text_input_commit_string, sl_text_input_cursor_position, sl_text_input_delete_surrounding_text, sl_text_input_keysym, sl_text_input_language, sl_text_input_text_direction, }; static void sl_destroy_host_text_input(struct wl_resource* resource) { struct sl_host_text_input* host = static_cast<sl_host_text_input*>(wl_resource_get_user_data(resource)); zwp_text_input_v1_destroy(host->proxy); wl_resource_set_user_data(resource, NULL); free(host); } static void sl_text_input_manager_create_text_input( struct wl_client* client, struct wl_resource* resource, uint32_t id) { struct sl_host_text_input_manager* host = static_cast<sl_host_text_input_manager*>( wl_resource_get_user_data(resource)); struct wl_resource* text_input_resource = wl_resource_create(client, &zwp_text_input_v1_interface, 1, id); struct sl_host_text_input* text_input_host = static_cast<sl_host_text_input*>( malloc(sizeof(struct sl_host_text_input))); text_input_host->resource = text_input_resource; text_input_host->ctx = host->ctx; text_input_host->proxy = zwp_text_input_manager_v1_create_text_input( host->ctx->text_input_manager->internal); wl_resource_set_implementation(text_input_resource, &sl_text_input_implementation, text_input_host, sl_destroy_host_text_input); zwp_text_input_v1_set_user_data(text_input_host->proxy, text_input_host); zwp_text_input_v1_add_listener(text_input_host->proxy, &sl_text_input_listener, text_input_host); } static void sl_destroy_host_text_input_manager(struct wl_resource* resource) { struct sl_host_text_input_manager* host = static_cast<sl_host_text_input_manager*>( wl_resource_get_user_data(resource)); zwp_text_input_manager_v1_destroy(host->proxy); wl_resource_set_user_data(resource, NULL); free(host); } static struct zwp_text_input_manager_v1_interface sl_text_input_manager_implementation = { sl_text_input_manager_create_text_input, }; static void sl_bind_host_text_input_manager(struct wl_client* client, void* data, uint32_t version, uint32_t id) { struct sl_context* ctx = (struct sl_context*)data; struct sl_text_input_manager* text_input_manager = ctx->text_input_manager; struct sl_host_text_input_manager* host = static_cast<sl_host_text_input_manager*>(malloc(sizeof(*host))); assert(host); host->ctx = ctx; host->resource = wl_resource_create(client, &zwp_text_input_manager_v1_interface, 1, id); wl_resource_set_implementation(host->resource, &sl_text_input_manager_implementation, host, sl_destroy_host_text_input_manager); host->proxy = static_cast<zwp_text_input_manager_v1*>(wl_registry_bind( wl_display_get_registry(ctx->display), text_input_manager->id, &zwp_text_input_manager_v1_interface, wl_resource_get_version(host->resource))); zwp_text_input_manager_v1_set_user_data(host->proxy, host); } struct sl_global* sl_text_input_manager_global_create(struct sl_context* ctx) { return sl_global_create(ctx, &zwp_text_input_manager_v1_interface, 1, ctx, sl_bind_host_text_input_manager); }
5f00a18d528a681a2195cba3c9ab1af334f4ea74
f7526c6fe55bf32435aa9f2ab7c42eaf332b195b
/AladdinGenesis/GameObject.h
d5d418aed0ba37d25621bdd932ec8ad4d45f3ceb
[]
no_license
hanh177/HAV_Aladdin
b72c0d80f1557aa877cfbfd7060be32d11d3f44b
2c2546c47e96ec05898ee64e6dddae9edb1c9d1a
refs/heads/master
2020-09-06T10:40:49.291971
2019-12-27T12:42:29
2019-12-27T12:42:29
220,398,766
0
1
null
null
null
null
UTF-8
C++
false
false
2,697
h
GameObject.h
#pragma once #include<d3dx9.h> #include<d3d9.h> #include"CGame.h" #include"Sprite.h" #include "Texture.h" #include<vector> #include "define.h" #include <iostream> #include<fstream> #include <Windows.h> #include <algorithm> #include "Camera.h" #include "debug.h" using namespace std; #define DISPLAY_BOX 0 class GameObject; typedef GameObject * LPGAMEOBJECT; struct CCollisionEvent; typedef CCollisionEvent * LPCOLLISIONEVENT; struct CCollisionEvent { LPGAMEOBJECT obj; float t, nx, ny; CCollisionEvent(float t, float nx, float ny, LPGAMEOBJECT obj = NULL) { this->t = t; this->nx = nx; this->ny = ny; this->obj = obj; } static bool compare(const LPCOLLISIONEVENT &a, LPCOLLISIONEVENT &b) { return a->t < b->t; } }; class GameObject { protected: int health; Type type; int id; float x, y; float vx, vy; float nx, ny; float dx, dy; DWORD dt; int currentState; bool isCollisWithWeapon; int isBeingHurt= - 1; vector<LPANIMATION> animations; public: GameObject(); void SetState(int state) { this->currentState = state; } void AddAnimation(int aniId); Type GetType(); int GetID(); void SetID(int id); void SetDirection(int Direction); int GetDirection(); void SetPosition(float x, float y); void GetPosition(float &x, float &y) { x = this->x; y = this->y; } float GetPosY() { return this->y; } float GetPosX() { return this->x; } void SetSpeed(float vx, float vy); void GetSpeed(float &vx, float &vy) { vx = this->vx; vy = this->vy; } void RenderBoundingBox(int, int); int GetHealth() { return this->health; } virtual void SubHealth() { this->health--; } void SubHealth(int x) { this->health = this->health - x; } void SetFinish() { } void Healing(int x) { this->health += x; } void SetHealth(int x) { this->health = x; } LPCOLLISIONEVENT SweptAABBEx(LPGAMEOBJECT coO); void CalcPotentialCollisions(vector<LPGAMEOBJECT> *coObjects, vector<LPCOLLISIONEVENT> &coEvents); void FilterCollision( vector<LPCOLLISIONEVENT> &coEvents, vector<LPCOLLISIONEVENT> &coEventsResult, float &min_tx, float &min_ty, float &nx, float &ny); bool AABBcollision(LPGAMEOBJECT gameobj); bool GetIsCollisWithWeapon() { return this->isCollisWithWeapon; } void SetIsBeingHurt(int isHurt) { this->isBeingHurt = isHurt; } int GetIsBeingHurt() { return this->isBeingHurt; } virtual void Update(DWORD dt, vector<LPGAMEOBJECT>* coObject); virtual void Render(); virtual int GetState() { return currentState; }; virtual float GetVx() { return vx; } virtual void LoadAni(); virtual void Reset(); virtual void Revival(); virtual void GetBoundingBox(float &left, float &top, float &right, float &bottom); ~GameObject(); };
e3288a0e93bb7408700234cfbe43e8ee71333519
3d44af6633b26423b8db63c7063a70ff561d81d3
/niuke/整数转换.cpp
03b71a01f3e9520de6696aecacec8b1c1fdf5d42
[]
no_license
ziming-liu/basic-C
1631c951f8a589b8e7babbbfba362e06b06d96b6
28679379e9c333968da501c8bb3badf701829fa6
refs/heads/master
2021-09-09T02:57:01.525183
2018-03-13T12:35:21
2018-03-13T12:35:21
98,203,123
0
0
null
null
null
null
UTF-8
C++
false
false
231
cpp
整数转换.cpp
#include <stdio.h> #include <string.h> #include <stdlib.h> int main() { unsigned int num; scanf("%d",&num); char s[100]; itoa(num,s,10); int len=strlen(s); char t; t=s[0];s[0]=s[len-1];s[len-1] =t; puts(s); return 0; }
ce64cd083fd1696bb7b36558a09050b225ed7bad
b234d465ed38f77b1dcd83429b5abafea1fea6a7
/Recitation9/main.cpp
2e37e5d5d8dd9f78bacee33cdc860249eb720fdd
[]
no_license
danielfu11/CSCI2270
3fc89b11746b280b016276fea9a07e96a2d88a6a
dfb8c167ac824321325b260ae8704325ba1eeb3a
refs/heads/master
2021-05-05T01:27:00.333791
2018-04-17T18:59:53
2018-04-17T18:59:53
119,596,455
0
0
null
null
null
null
UTF-8
C++
false
false
831
cpp
main.cpp
#include "Graph.cpp" #include <iostream> #include <string> #include <fstream> #include <sstream> #include <vector> using namespace std; int main(){ Graph city; std::vector<std::vector<std::string>> matrix; ifstream inFile("mat.txt"); std::string data; while(getline(inFile, data)){ stringstream ss(data); std::vector<std::string> tempv; std::string current; while(ss >> current){ tempv.push_back(current); } matrix.push_back(tempv); } for (int i = 1; i < 5; i++){ city.addVertex(matrix[i][0]); } for (int j = 2; j < 5; j++){ city.addEdge(matrix[1][0],matrix[0][j],stoi(matrix[1][j])); } for (int k = 3; k < 5; k++){ city.addEdge(matrix[2][0],matrix[0][k],stoi(matrix[2][k])); } for (int l = 4; l < 5; l++){ city.addEdge(matrix[3][0],matrix[0][l],stoi(matrix[2][l])); } city.displayEdges(); }
993555e79a88d2c4841f2024a363fd30263a4b50
f33f3470ca81dcd7d85acac24fbf83cb868cb6f6
/TemplateMethodDP/Demo.cpp
c8283fcc7b3c713c7bd38d337cf7233dcbdc126e
[]
no_license
tonyseo7/StrategyMethodDP
2dcc20114d1958788d2b776f48665e0b7122ce18
457c520039e36ccdb9dd0125a420b4aba8023e07
refs/heads/master
2020-12-31T07:12:05.387538
2017-02-01T02:39:57
2017-02-01T02:39:57
80,583,720
0
0
null
null
null
null
UTF-8
C++
false
false
89
cpp
Demo.cpp
#include "Viewer.h" void main() { MyApp *app = new MyApp(); app->Do(); delete app; }
ca760da4af80a06959698d91331d9d762c30870d
4f7c53c128328f294e9b67a4eb00b72c459692e6
/app/Contractor/ContractorAdditionalTypeIdModel.cpp
3dd49f61e03d4915b6bfc3ea36b0fb6aa68a82a6
[]
no_license
milczarekIT/agila
a94d59c1acfe171eb361be67acda1c5babc69df6
ec0ddf53dfa54aaa21d48b5e7f334aabcba5227e
refs/heads/master
2021-01-10T06:39:56.117202
2013-08-24T20:15:22
2013-08-24T20:15:22
46,000,158
1
1
null
null
null
null
UTF-8
C++
false
false
1,420
cpp
ContractorAdditionalTypeIdModel.cpp
#include "ContractorAdditionalTypeIdModel.h" ContractorAdditionalTypeIdModel::ContractorAdditionalTypeIdModel() { } ContractorAdditionalTypeIdModel::~ContractorAdditionalTypeIdModel() { } QVector<SimpleStructure> ContractorAdditionalTypeIdModel::getTypeIds() { QVector<SimpleStructure> typeIds; query = new QSqlQuery(Database::getInstance().db); query->exec("SELECT id, name FROM contractors_additional_ids"); if(this->isQueryError(query)) throw new SQLException("ContractorAdditionalTypeIdModel::getTypeIds", query); else if(query->size() > 0) { SimpleStructure ss; while(query->next()) { ss.setId(query->value(0).toInt()); ss.setName(query->value(1).toString()); typeIds.push_back(ss); } } delete query; return typeIds; } SimpleStructure ContractorAdditionalTypeIdModel::getTypeId(int id) { SimpleStructure ss; query = new QSqlQuery(Database::getInstance().db); query->prepare("SELECT name FROM contractors_additional_ids WHERE id = :id"); query->bindValue(":id", id); query->exec(); if(this->isQueryError(query)) throw new SQLException("ContractorAdditionalTypeIdModel::getTypeId", query); else if(query->size()) { query->first(); ss.setId(id); ss.setName(query->value(0).toString()); } delete query; return ss; }
a8315ab089bba4c0da5e5583baeb4fe3b45c6233
05dd6c56b0c3e36c3230a620ce63b9b62e93ba8e
/Task/06/Homework6-2.cpp
e424de538d4e70607d58a1bb2e577f6ae5691134
[]
no_license
jckling/Learn-C
3b37d819ff9c40c79991a07dfcbe809e380a47c2
56d8c8a47ccb371d627cc6ff39ca5fda66496316
refs/heads/master
2021-01-01T04:03:50.851823
2019-07-07T06:07:05
2019-07-07T06:07:05
97,115,103
3
1
null
null
null
null
UTF-8
C++
false
false
239
cpp
Homework6-2.cpp
#include<stdio.h> int Add(int, int); int main() { int a, b; int result; scanf("%d,%d", &a, &b); result = Add(a, a * (b - 1)); printf("%d", result); return 0; } int Add(int x, int y) { int result; result = x + y; return result; }
384c1217e124a7b4ca20d8cb29733a2f4dc001ae
0786e7fb03f800b6917a34e176bd513a465f245f
/system/utest/zxs/zxs-test.cpp
53c7d42922bf319ec3648c892663c1f224ce2050
[ "BSD-3-Clause", "MIT" ]
permissive
bhaavanmerchant/zircon
f158829031652ebb775c0ad7a9b0fe23e4df03d4
13cd388351d058d048df5f159c86223b1cfd307c
refs/heads/master
2020-04-08T00:06:09.009908
2019-01-29T19:25:30
2019-01-29T20:55:39
158,837,766
2
1
null
null
null
null
UTF-8
C++
false
false
11,630
cpp
zxs-test.cpp
// Copyright 2018 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <lib/async-loop/loop.h> #include <lib/async/cpp/wait.h> #include <lib/zx/socket.h> #include <lib/zxs/protocol.h> #include <lib/zxs/zxs.h> #include <string.h> #include <sys/socket.h> #include <zircon/status.h> #include <unittest/unittest.h> #include <utility> #define IOCTL_ZXS_TEST \ IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_TEST, 1) static void destroy_wait(async::Wait* wait) { zx_handle_close(wait->object()); delete wait; } static zx_status_t start_socket_server(async_dispatcher_t* dispatcher, zx::socket remote); static zx_status_t handle_message(async_dispatcher_t* dispatcher, async::Wait* wait, zxsio_msg_t* msg) { zxsio_msg_t reply; memset(&reply, 0, sizeof(reply)); reply.txid = msg->txid; reply.op = msg->op; switch (msg->op) { case ZXSIO_GETSOCKNAME: { struct sockaddr addr; memset(&addr, 0, sizeof(addr)); addr.sa_family = AF_IPX; addr.sa_data[0] = 'i'; addr.sa_data[1] = 'p'; addr.sa_data[2] = 'x'; addr.sa_data[3] = ' '; addr.sa_data[4] = 's'; addr.sa_data[5] = 'o'; addr.sa_data[6] = 'c'; addr.sa_data[7] = 'k'; zxrio_sockaddr_reply_t payload; memset(&payload, 0, sizeof(payload)); memcpy(&payload.addr, &addr, sizeof(addr)); payload.len = sizeof(addr); reply.datalen = sizeof(payload); memcpy(reply.data, &payload, sizeof(payload)); break; } case ZXSIO_GETPEERNAME: { struct sockaddr addr; memset(&addr, 0, sizeof(addr)); addr.sa_family = AF_IPX; addr.sa_data[0] = 'i'; addr.sa_data[1] = 'p'; addr.sa_data[2] = 'x'; addr.sa_data[3] = ' '; addr.sa_data[4] = 'p'; addr.sa_data[5] = 'e'; addr.sa_data[6] = 'e'; addr.sa_data[7] = 'r'; zxrio_sockaddr_reply_t payload; memset(&payload, 0, sizeof(payload)); memcpy(&payload.addr, &addr, sizeof(addr)); payload.len = sizeof(addr); reply.datalen = sizeof(payload); memcpy(reply.data, &payload, sizeof(payload)); break; } case ZXSIO_SETSOCKOPT: { zxrio_sockopt_req_reply_t payload; memset(&payload, 0, sizeof(payload)); memcpy(&payload, msg->data, sizeof(payload)); if (payload.level != IPPROTO_IP || payload.optname != IP_TTL) { return ZX_ERR_STOP; } break; } case ZXSIO_GETSOCKOPT: { zxrio_sockopt_req_reply_t payload; memset(&payload, 0, sizeof(payload)); memcpy(&payload, msg->data, sizeof(payload)); if (payload.level != IPPROTO_IP || payload.optname != IP_TTL || payload.optlen != 0) { return ZX_ERR_STOP; } int result = 128; memset(payload.optval, 0, sizeof(payload.optval)); memcpy(payload.optval, &result, sizeof(result)); payload.optlen = sizeof(int); reply.datalen = sizeof(payload); memcpy(reply.data, &payload, sizeof(payload)); break; } case ZXSIO_CONNECT: { // No reply needed. break; } case ZXSIO_BIND: { // No reply needed. break; } case ZXSIO_LISTEN: { int backlog = -1; memcpy(&backlog, msg->data, sizeof(backlog)); if (backlog != 5) { printf("ZXSIO_LISTEN received backlog=%d.\n", backlog); return ZX_ERR_STOP; } zx::socket local, remote; zx_status_t status = zx::socket::create(ZX_SOCKET_HAS_CONTROL, &local, &remote); if (status != ZX_OK) { printf("ZXSIO_LISTEN failed to create sockets: %d (%s)\n", status, zx_status_get_string(status)); return ZX_ERR_STOP; } status = zx_socket_share(wait->object(), remote.release()); if (status != ZX_OK) { printf("ZXSIO_LISTEN failed to share socket: %d (%s)\n", status, zx_status_get_string(status)); return ZX_ERR_STOP; } status = start_socket_server(dispatcher, std::move(local)); if (status != ZX_OK) { printf("ZXSIO_LISTEN failed to start socket server: %d (%s)\n", status, zx_status_get_string(status)); return ZX_ERR_STOP; } break; } case ZXSIO_CLOSE: { // No reply needed. break; } case ZXSIO_IOCTL: { if (msg->arg2.op != IOCTL_ZXS_TEST) { printf("ZXSIO_IOCTL received the wrong op: %x\n", msg->arg2.op); return ZX_ERR_STOP; } reply.datalen = 4u; memcpy(reply.data, "abcd", reply.datalen); break; } default: return ZX_ERR_STOP; } size_t actual = 0u; zx_status_t status = zx_socket_write( wait->object(), ZX_SOCKET_CONTROL, &reply, ZXSIO_HDR_SZ + reply.datalen, &actual); EXPECT_EQ(ZX_OK, status); EXPECT_EQ(ZXSIO_HDR_SZ + reply.datalen, actual); return ZX_OK; } static zx_status_t start_socket_server(async_dispatcher_t* dispatcher, zx::socket remote) { auto wait = new async::Wait( remote.release(), ZX_SOCKET_CONTROL_READABLE | ZX_SOCKET_PEER_CLOSED); wait->set_handler([](async_dispatcher_t* dispatcher, async::Wait* wait, zx_status_t status, const zx_packet_signal_t* signal) { if (status != ZX_OK) { destroy_wait(wait); } else if (signal->observed & ZX_SOCKET_CONTROL_READABLE) { zxsio_msg_t msg; memset(&msg, 0, sizeof(msg)); size_t actual = 0u; status = zx_socket_read(wait->object(), ZX_SOCKET_CONTROL, &msg, sizeof(msg), &actual); if (status != ZX_OK) { destroy_wait(wait); return; } zx_status_t status = handle_message(dispatcher, wait, &msg); if (status != ZX_OK) { destroy_wait(wait); return; } status = wait->Begin(dispatcher); if (status != ZX_OK) { destroy_wait(wait); return; } } else if (signal->observed & ZX_SOCKET_PEER_CLOSED) { destroy_wait(wait); } }); zx_status_t status = wait->Begin(dispatcher); if (status != ZX_OK) { destroy_wait(wait); } return status; } struct FakeNetstack { async_loop_t* loop; zxs_socket_t socket; }; static bool SetUp(FakeNetstack* fake) { zx_status_t status = ZX_OK; ASSERT_EQ(ZX_OK, async_loop_create(&kAsyncLoopConfigNoAttachToThread, &fake->loop), ""); ASSERT_EQ(ZX_OK, async_loop_start_thread(fake->loop, "fake-netstack", nullptr), ""); async_dispatcher_t* dispatcher = async_loop_get_dispatcher(fake->loop); zx::socket local, remote; status = zx::socket::create(ZX_SOCKET_HAS_CONTROL | ZX_SOCKET_HAS_ACCEPT, &local, &remote); ASSERT_EQ(ZX_OK, status); status = start_socket_server(dispatcher, std::move(remote)); ASSERT_EQ(ZX_OK, status); fake->socket = { .socket = local.release(), .flags = 0u, }; return true; } static void TearDown(FakeNetstack* fake) { zx_handle_close(fake->socket.socket); async_loop_destroy(fake->loop); } static bool connect_test(void) { BEGIN_TEST; FakeNetstack fake; if (!SetUp(&fake)) return false; zxs_socket_t* socket = &fake.socket; struct sockaddr addr; memset(&addr, 0, sizeof(addr)); ASSERT_EQ(ZX_OK, zxs_connect(socket, &addr, sizeof(addr))); TearDown(&fake); END_TEST; } static bool bind_test(void) { BEGIN_TEST; FakeNetstack fake; if (!SetUp(&fake)) return false; zxs_socket_t* socket = &fake.socket; struct sockaddr addr; memset(&addr, 0, sizeof(addr)); ASSERT_EQ(ZX_OK, zxs_bind(socket, &addr, sizeof(addr))); TearDown(&fake); END_TEST; } static bool getsockname_test(void) { BEGIN_TEST; FakeNetstack fake; if (!SetUp(&fake)) return false; zxs_socket_t* socket = &fake.socket; struct sockaddr addr; memset(&addr, 0, sizeof(addr)); size_t actual = 0u; ASSERT_EQ(ZX_OK, zxs_getsockname(socket, &addr, sizeof(addr), &actual)); ASSERT_EQ(sizeof(addr), actual); ASSERT_EQ('s', addr.sa_data[4]); TearDown(&fake); END_TEST; } static bool getpeername_test(void) { BEGIN_TEST; FakeNetstack fake; if (!SetUp(&fake)) return false; zxs_socket_t* socket = &fake.socket; struct sockaddr addr; memset(&addr, 0, sizeof(addr)); size_t actual = 0u; ASSERT_EQ(ZX_OK, zxs_getpeername(socket, &addr, sizeof(addr), &actual)); ASSERT_EQ(sizeof(addr), actual); ASSERT_EQ('p', addr.sa_data[4]); TearDown(&fake); END_TEST; } static bool sockopts_test(void) { BEGIN_TEST; FakeNetstack fake; if (!SetUp(&fake)) return false; zxs_socket_t* socket = &fake.socket; int ttl = 255; zxs_option_t option = { .level = IPPROTO_IP, .name = IP_TTL, .value = &ttl, .length = sizeof(ttl), }; ASSERT_EQ(ZX_OK, zxs_setsockopts(socket, &option, 1u)); ttl = 0; size_t actual = 0u; ASSERT_EQ(ZX_OK, zxs_getsockopt(socket, IPPROTO_IP, IP_TTL, &ttl, sizeof(ttl), &actual)); ASSERT_EQ(sizeof(int), actual); ASSERT_EQ(128, ttl); TearDown(&fake); END_TEST; } static bool listen_accept_test(void) { BEGIN_TEST; FakeNetstack fake; if (!SetUp(&fake)) return false; zxs_socket_t* socket = &fake.socket; ASSERT_EQ(ZX_OK, zxs_listen(socket, 5)); struct sockaddr addr; memset(&addr, 0, sizeof(addr)); size_t actual = 0u; zxs_socket_t accepted; memset(&accepted, 0, sizeof(accepted)); ASSERT_EQ(ZX_OK, zxs_accept(socket, &addr, sizeof(addr), &actual, &accepted)); ASSERT_EQ(sizeof(addr), actual); ASSERT_EQ('p', addr.sa_data[4]); ASSERT_NE(ZX_HANDLE_INVALID, accepted.socket); ASSERT_EQ(ZX_OK, zx_handle_close(accepted.socket)); TearDown(&fake); END_TEST; } static bool close_test(void) { BEGIN_TEST; FakeNetstack fake; if (!SetUp(&fake)) return false; zxs_socket_t* socket = &fake.socket; ASSERT_EQ(ZX_OK, zxs_close(socket)); fake.socket.socket = ZX_HANDLE_INVALID; TearDown(&fake); END_TEST; } static bool ioctl_test(void) { BEGIN_TEST; FakeNetstack fake; if (!SetUp(&fake)) return false; zxs_socket_t* socket = &fake.socket; const char* in_buffer = "xyz"; char out_buffer[16]; memset(out_buffer, 0, sizeof(out_buffer)); size_t actual = 0u; ASSERT_EQ(ZX_OK, zxs_ioctl(socket, IOCTL_ZXS_TEST, in_buffer, 3, out_buffer, sizeof(out_buffer), &actual)); ASSERT_EQ(4, actual); TearDown(&fake); END_TEST; } BEGIN_TEST_CASE(zxs_test) RUN_TEST(connect_test); RUN_TEST(bind_test); RUN_TEST(getsockname_test); RUN_TEST(getpeername_test); RUN_TEST(sockopts_test); RUN_TEST(listen_accept_test); RUN_TEST(close_test); RUN_TEST(ioctl_test); END_TEST_CASE(zxs_test)
a4419acbe2752736fd1a9e33d7123eaf057adf24
400b1c7c4d4df879382387c68371b2b3fbda5d86
/maths/quaternion.cpp
c9df7ee0953aa9c46c49dc0d98aaafd8b0b7c83d
[]
no_license
grantclarke-abertay/gef
c5bbc131eee9d7577cc47862aac1c215d434f0fd
f75d686977899f115ead0062357bd8272bdfd367
refs/heads/master
2020-07-18T02:38:55.621559
2017-10-13T05:59:26
2017-10-13T05:59:26
67,597,774
12
4
null
2017-10-13T06:11:26
2016-09-07T10:42:37
C++
UTF-8
C++
false
false
3,469
cpp
quaternion.cpp
#include <maths/quaternion.h> #include <maths/matrix44.h> namespace gef { const Quaternion Quaternion::kIdentity(0.0f, 0.0f, 0.0f, 1.0f); Quaternion::Quaternion(const Matrix44& matrix) { SetFromMatrix(matrix); } void Quaternion::Identity() { x = 0.0f; y = 0.0f; z = 0.0f; w = 1.0f; } void Quaternion::SetFromMatrix(const Matrix44& matrix) { int i, maxi; float maxdiag, S, trace; trace = matrix.m(0,0) + matrix.m(1,1) + matrix.m(2,2) + 1.0f; // tried comparing trace to 0.0f, but got incorrect result when trace was 5.0 x 10e-5 if ( trace > 0.000001f) { x = ( matrix.m(1,2) - matrix.m(2,1) ) / ( 2.0f * sqrtf(trace) ); y = ( matrix.m(2,0) - matrix.m(0,2) ) / ( 2.0f * sqrtf(trace) ); z = ( matrix.m(0,1) - matrix.m(1,0) ) / ( 2.0f * sqrtf(trace) ); w = sqrtf(trace) / 2.0f; return; } maxi = 0; maxdiag = matrix.m(0,0); for (i=1; i<3; i++) { if ( matrix.m(i,i) > maxdiag ) { maxi = i; maxdiag = matrix.m(i,i); } } switch( maxi ) { case 0: S = 2.0f * sqrtf(1.0f + matrix.m(0,0) - matrix.m(1,1) - matrix.m(2,2)); x = 0.25f * S; y = ( matrix.m(0,1) + matrix.m(1,0) ) / S; z = ( matrix.m(0,2) + matrix.m(2,0) ) / S; w = ( matrix.m(1,2) - matrix.m(2,1) ) / S; break; case 1: S = 2.0f * sqrtf(1.0f + matrix.m(1,1) - matrix.m(0,0) - matrix.m(2,2)); x = ( matrix.m(0,1) + matrix.m(1,0) ) / S; y = 0.25f * S; z = ( matrix.m(1,2) + matrix.m(2,1) ) / S; w = ( matrix.m(2,0) - matrix.m(0,2) ) / S; break; case 2: S = 2.0f * sqrtf(1.0f + matrix.m(2,2) - matrix.m(0,0) - matrix.m(1,1)); x = ( matrix.m(0,2) + matrix.m(2,0) ) / S; y = ( matrix.m(1,2) + matrix.m(2,1) ) / S; z = 0.25f * S; w = ( matrix.m(0,1) - matrix.m(1,0) ) / S; break; } } void Quaternion::Lerp(const Quaternion& startQ, const Quaternion& endQ, float time) { x = (1.0f - time) * startQ.x + time * endQ.x; y = (1.0f - time) * startQ.y + time * endQ.y; z = (1.0f - time) * startQ.z + time * endQ.z; w = (1.0f - time) * startQ.w + time * endQ.w; } void Quaternion::Slerp(const Quaternion& startQ, const Quaternion& endQ, float time) { float dot = startQ.x*endQ.x + startQ.y*endQ.y + startQ.z*endQ.z + startQ.w*endQ.w; if(dot >= 1.0f) { *this = endQ; } else { /* dot = cos(theta) if (dot < 0), q1 and q2 are more than 90 degrees apart, so we can invert one to reduce spinning */ Quaternion targetQ; if (dot < 0.0f) { dot = -dot; targetQ = -endQ; } else targetQ = endQ; float angle = acosf(dot); *this = (startQ*sinf(angle*(1.0f-time)) + targetQ*sinf(angle*time))/sinf(angle); } } // result = this * quaternion; // when used to represent rotations // the result quaternion represents an initial rotation specified by quaternion rotated by "this" const Quaternion Quaternion::operator * (const Quaternion& quaternion) const { Quaternion result; result.x = quaternion.w * x + quaternion.x * w + quaternion.y * z - quaternion.z * y; result.y = quaternion.w * y - quaternion.x * z + quaternion.y * w + quaternion.z * x; result.z = quaternion.w * z + quaternion.x * y - quaternion.y * x + quaternion.z * w; result.w = quaternion.w * w - quaternion.x * x - quaternion.y * y - quaternion.z * z; return result; } void Quaternion::Normalise() { float length = Length(); x /= length; y /= length; z /= length; w /= length; } void Quaternion::Conjugate(const Quaternion& quaternion) { x = -quaternion.x; y = -quaternion.y; z = -quaternion.z; w = quaternion.w; } }
78584ce152400378c6e186a687a6bcdffad4505e
e929a84dec3a6e710351261a6de895308efa6d33
/code/game/AI_BobaFett.cpp
a9f86a21cce0d3cb3c7f1feef08d28be6193b09a
[]
no_license
xLAva/JediAcademyLinux
570d85e1e24d950ab63e9297135248362d873dbd
1d31492a576106e104f49bd9b5fe7f7792a90e89
refs/heads/JediAcademyLinux
2021-01-18T21:23:43.164581
2014-11-29T13:52:49
2014-11-29T13:52:49
9,734,512
125
18
null
2013-09-24T19:02:36
2013-04-28T18:51:54
C++
UTF-8
C++
false
false
37,806
cpp
AI_BobaFett.cpp
//////////////////////////////////////////////////////////////////////////////////////// // RAVEN SOFTWARE - STAR WARS: JK II // (c) 2002 Activision // // Boba Fett // --------- // Ah yes, this file is pretty messy. I've tried to move everything in here, but in fact // a lot of his AI occurs in the seeker and jedi AI files. Some of these functions // // // //////////////////////////////////////////////////////////////////////////////////////// #include "g_headers.h" #include "b_local.h" #include "g_nav.h" #if !defined(RAVL_VEC_INC) #include "../Ravl/CVec.h" #endif //////////////////////////////////////////////////////////////////////////////////////// // Forward References Of Functions //////////////////////////////////////////////////////////////////////////////////////// void Boba_Precache( void ); void Boba_DustFallNear(const vec3_t origin, int dustcount); void Boba_ChangeWeapon(int wp); qboolean Boba_StopKnockdown(gentity_t *self, gentity_t *pusher, const vec3_t pushDir, qboolean forceKnockdown = qfalse); // Flight Related Functions (also used by Rocket Trooper) //-------------------------------------------------------- qboolean Boba_Flying( gentity_t *self ); void Boba_FlyStart( gentity_t *self ); void Boba_FlyStop( gentity_t *self ); // Called From NPC_Pain() //----------------------------- void Boba_Pain( gentity_t *self, gentity_t *inflictor, int damage, int mod); // Local: Flame Thrower Weapon //----------------------------- void Boba_FireFlameThrower( gentity_t *self ); void Boba_StopFlameThrower( gentity_t *self ); void Boba_StartFlameThrower( gentity_t *self ); void Boba_DoFlameThrower( gentity_t *self ); // Local: Other Tactics //---------------------- void Boba_DoAmbushWait( gentity_t *self); void Boba_DoSniper( gentity_t *self); // Local: Respawning //------------------- bool Boba_Respawn(); // Called From Within AI_Jedi && AI_Seeker //----------------------------------------- void Boba_Fire(); void Boba_FireDecide(); // Local: Called From Tactics() //---------------------------- void Boba_TacticsSelect(); bool Boba_CanSeeEnemy( gentity_t *self ); // Called From NPC_RunBehavior() //------------------------------- void Boba_Update(); // Always Called First, Before Any Other Thinking bool Boba_Tactics(); // If returns true, Jedi and Seeker AI not used bool Boba_Flee(); // If returns true, Jedi and Seeker AI not used //////////////////////////////////////////////////////////////////////////////////////// // External Functions //////////////////////////////////////////////////////////////////////////////////////// extern void G_SoundAtSpot( vec3_t org, int soundIndex, qboolean broadcast ); extern void G_CreateG2AttachedWeaponModel( gentity_t *ent, const char *weaponModel, int boltNum, int weaponNum ); extern void ChangeWeapon( gentity_t *ent, int newWeapon ); extern void WP_ResistForcePush( gentity_t *self, gentity_t *pusher, qboolean noPenalty ); extern void ForceJump( gentity_t *self, usercmd_t *ucmd ); extern void G_Knockdown( gentity_t *self, gentity_t *attacker, const vec3_t pushDir, float strength, qboolean breakSaberLock ); //////////////////////////////////////////////////////////////////////////////////////// // External Data //////////////////////////////////////////////////////////////////////////////////////// extern cvar_t* g_bobaDebug; //////////////////////////////////////////////////////////////////////////////////////// // Boba Debug Output //////////////////////////////////////////////////////////////////////////////////////// #ifndef FINAL_BUILD #if !defined(CTYPE_H_INC) #include <ctype.h> #define CTYPE_H_INC #endif #if !defined(STDARG_H_INC) #include <stdarg.h> #define STDARG_H_INC #endif #if !defined(STDIO_H_INC) #include <stdio.h> #define STDIO_H_INC #endif void Boba_Printf(const char * format, ...) { if (g_bobaDebug->integer==0) { return; } static char string[2][1024]; // in case this is called by nested functions static int index = 0; static char nFormat[300]; char* buf; // Tack On The Standard Format Around The Given Format //----------------------------------------------------- sprintf(nFormat, "[BOBA %8d] %s\n", level.time, format); // Resolve Remaining Elipsis Parameters Into Newly Formated String //----------------------------------------------------------------- buf = string[index & 1]; index++; va_list argptr; va_start (argptr, format); vsprintf (buf, nFormat, argptr); va_end (argptr); // Print It To Debug Output Console //---------------------------------- gi.Printf(buf); } #else void Boba_Printf(const char * format, ...) { } #endif //////////////////////////////////////////////////////////////////////////////////////// // Defines //////////////////////////////////////////////////////////////////////////////////////// #define BOBA_FLAMEDURATION 3000 #define BOBA_FLAMETHROWRANGE 128 #define BOBA_FLAMETHROWSIZE 40 #define BOBA_FLAMETHROWDAMAGEMIN 1//10 #define BOBA_FLAMETHROWDAMAGEMAX 5//40 #define BOBA_ROCKETRANGEMIN 300 #define BOBA_ROCKETRANGEMAX 2000 //////////////////////////////////////////////////////////////////////////////////////// // Global Data //////////////////////////////////////////////////////////////////////////////////////// bool BobaHadDeathScript = false; bool BobaActive = false; vec3_t BobaFootStepLoc; int BobaFootStepCount = 0; vec3_t AverageEnemyDirection; int AverageEnemyDirectionSamples; //////////////////////////////////////////////////////////////////////////////////////// // Enums //////////////////////////////////////////////////////////////////////////////////////// enum EBobaTacticsState { BTS_NONE, // Attack //-------- BTS_RIFLE, // Uses Jedi / Seeker Movement BTS_MISSILE, // Uses Jedi / Seeker Movement BTS_SNIPER, // Uses Special Movement Internal To This File BTS_FLAMETHROW, // Locked In Place // Waiting //--------- BTS_AMBUSHWAIT, // Goto CP & Wait BTS_MAX }; //////////////////////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////////////////////// void Boba_Precache( void ) { G_SoundIndex( "sound/chars/boba/bf_blast-off.wav" ); G_SoundIndex( "sound/chars/boba/bf_jetpack_lp.wav" ); G_SoundIndex( "sound/chars/boba/bf_land.wav" ); G_SoundIndex( "sound/weapons/boba/bf_flame.mp3" ); G_SoundIndex( "sound/player/footsteps/boot1" ); G_SoundIndex( "sound/player/footsteps/boot2" ); G_SoundIndex( "sound/player/footsteps/boot3" ); G_SoundIndex( "sound/player/footsteps/boot4" ); G_EffectIndex( "boba/jetSP" ); G_EffectIndex( "boba/fthrw" ); G_EffectIndex( "volumetric/black_smoke" ); G_EffectIndex( "chunks/dustFall" ); AverageEnemyDirectionSamples = 0; VectorClear(AverageEnemyDirection); BobaHadDeathScript = false; BobaActive = true; BobaFootStepCount = 0; } //////////////////////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////////////////////// void Boba_DustFallNear(const vec3_t origin, int dustcount) { if (!BobaActive) { return; } trace_t testTrace; vec3_t testDirection; vec3_t testStartPos; vec3_t testEndPos; VectorCopy(origin, testStartPos); for (int i=0; i<dustcount; i++) { testDirection[0] = (randomLava() * 2.0f) - 1.0f; testDirection[1] = (randomLava() * 2.0f) - 1.0f; testDirection[2] = 1.0f; VectorMA(origin, 1000.0f, testDirection, testEndPos); gi.trace (&testTrace, origin, NULL, NULL, testEndPos, (player && player->inuse)?(0):(ENTITYNUM_NONE), MASK_SHOT, G2_NOCOLLIDE, 0 ); if (!testTrace.startsolid && !testTrace.allsolid && testTrace.fraction>0.1f && testTrace.fraction<0.9f) { G_PlayEffect( "chunks/dustFall", testTrace.endpos, testTrace.plane.normal ); } } } //////////////////////////////////////////////////////////////////////////////////////// // This is just a super silly wrapper around NPC_Change Weapon //////////////////////////////////////////////////////////////////////////////////////// void Boba_ChangeWeapon( int wp ) { if ( NPC->s.weapon == wp ) { return; } NPC_ChangeWeapon( wp ); G_AddEvent( NPC, EV_GENERAL_SOUND, G_SoundIndex( "sound/weapons/change.wav" )); } //////////////////////////////////////////////////////////////////////////////////////// // Choose an "anti-knockdown" response //////////////////////////////////////////////////////////////////////////////////////// qboolean Boba_StopKnockdown( gentity_t *self, gentity_t *pusher, const vec3_t pushDir, qboolean forceKnockdown ) { if ( self->client->NPC_class != CLASS_BOBAFETT ) { return qfalse; } if ( self->client->moveType == MT_FLYSWIM ) {//can't knock me down when I'm flying return qtrue; } vec3_t pDir, fwd, right, ang = {0, self->currentAngles[YAW], 0}; float fDot, rDot; int strafeTime = Q_irand( 1000, 2000 ); AngleVectors( ang, fwd, right, NULL ); VectorNormalize2( pushDir, pDir ); fDot = DotProduct( pDir, fwd ); rDot = DotProduct( pDir, right ); if ( Q_irand( 0, 2 ) ) {//flip or roll with it usercmd_t tempCmd; if ( fDot >= 0.4f ) { tempCmd.forwardmove = 127; TIMER_Set( self, "moveforward", strafeTime ); } else if ( fDot <= -0.4f ) { tempCmd.forwardmove = -127; TIMER_Set( self, "moveback", strafeTime ); } else if ( rDot > 0 ) { tempCmd.rightmove = 127; TIMER_Set( self, "strafeRight", strafeTime ); TIMER_Set( self, "strafeLeft", -1 ); } else { tempCmd.rightmove = -127; TIMER_Set( self, "strafeLeft", strafeTime ); TIMER_Set( self, "strafeRight", -1 ); } G_AddEvent( self, EV_JUMP, 0 ); if ( !Q_irand( 0, 1 ) ) {//flip self->client->ps.forceJumpCharge = 280;//FIXME: calc this intelligently? ForceJump( self, &tempCmd ); } else {//roll TIMER_Set( self, "duck", strafeTime ); } self->painDebounceTime = 0;//so we do something } else if ( !Q_irand( 0, 1 ) && forceKnockdown ) {//resist WP_ResistForcePush( self, pusher, qtrue ); } else {//fall down return qfalse; } return qtrue; } //////////////////////////////////////////////////////////////////////////////////////// // Is this entity flying //////////////////////////////////////////////////////////////////////////////////////// qboolean Boba_Flying( gentity_t *self ) { assert(self && self->client && self->client->NPC_class==CLASS_BOBAFETT);//self->NPC && return ((qboolean)(self->client->moveType==MT_FLYSWIM)); } //////////////////////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////////////////////// bool Boba_CanSeeEnemy( gentity_t *self ) { assert(self && self->NPC && self->client && self->client->NPC_class==CLASS_BOBAFETT); return ((level.time - self->NPC->enemyLastSeenTime)<1000); } //////////////////////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////////////////////// void Boba_Pain( gentity_t *self, gentity_t *inflictor, int damage, int mod) { if (mod==MOD_SABER && !(NPCInfo->aiFlags&NPCAI_FLAMETHROW)) { TIMER_Set( self, "Boba_TacticsSelect", 0); // Hurt By The Saber, Time To Try Something New } if (self->NPC->aiFlags&NPCAI_FLAMETHROW) { NPC_SetAnim( self, SETANIM_TORSO, BOTH_FORCELIGHTNING_HOLD, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD ); self->client->ps.torsoAnimTimer = level.time - TIMER_Get(self, "falmeTime"); } } //////////////////////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////////////////////// void Boba_FlyStart( gentity_t *self ) {//switch to seeker AI for a while if ( TIMER_Done( self, "jetRecharge" ) && !Boba_Flying( self ) ) { self->client->ps.gravity = 0; self->svFlags |= SVF_CUSTOM_GRAVITY; self->client->moveType = MT_FLYSWIM; //start jet effect self->client->jetPackTime = level.time + Q_irand( 3000, 10000 ); if ( self->genericBolt1 != -1 ) { G_PlayEffect( G_EffectIndex( "boba/jetSP" ), self->playerModel, self->genericBolt1, self->s.number, self->currentOrigin, qtrue, qtrue ); } if ( self->genericBolt2 != -1 ) { G_PlayEffect( G_EffectIndex( "boba/jetSP" ), self->playerModel, self->genericBolt2, self->s.number, self->currentOrigin, qtrue, qtrue ); } //take-off sound G_SoundOnEnt( self, CHAN_ITEM, "sound/chars/boba/bf_blast-off.wav" ); //jet loop sound self->s.loopSound = G_SoundIndex( "sound/chars/boba/bf_jetpack_lp.wav" ); if ( self->NPC ) { self->count = Q3_INFINITE; // SEEKER shot ammo count } } } //////////////////////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////////////////////// void Boba_FlyStop( gentity_t *self ) { self->client->ps.gravity = g_gravity->value; self->svFlags &= ~SVF_CUSTOM_GRAVITY; self->client->moveType = MT_RUNJUMP; //Stop effect self->client->jetPackTime = 0; if ( self->genericBolt1 != -1 ) { G_StopEffect( "boba/jetSP", self->playerModel, self->genericBolt1, self->s.number ); } if ( self->genericBolt2 != -1 ) { G_StopEffect( "boba/jetSP", self->playerModel, self->genericBolt2, self->s.number ); } //stop jet loop sound G_SoundOnEnt( self, CHAN_ITEM, "sound/chars/boba/bf_land.wav" ); self->s.loopSound = 0; if ( self->NPC ) { self->count = 0; // SEEKER shot ammo count TIMER_Set( self, "jetRecharge", Q_irand( 1000, 5000 ) ); TIMER_Set( self, "jumpChaseDebounce", Q_irand( 500, 2000 ) ); } } //////////////////////////////////////////////////////////////////////////////////////// // This func actually does the damage inflicting traces //////////////////////////////////////////////////////////////////////////////////////// void Boba_FireFlameThrower( gentity_t *self ) { trace_t tr; vec3_t start, end, dir; CVec3 traceMins(self->mins); CVec3 traceMaxs(self->maxs); gentity_t* traceEnt = NULL; int damage = Q_irand( BOBA_FLAMETHROWDAMAGEMIN, BOBA_FLAMETHROWDAMAGEMAX ); AngleVectors(self->currentAngles, dir, 0, 0); dir[2] = 0.0f; VectorCopy(self->currentOrigin, start); traceMins *= 0.5f; traceMaxs *= 0.5f; start[2] += 40.0f; VectorMA( start, 150.0f, dir, end ); if (g_bobaDebug->integer) { CG_DrawEdge(start, end, EDGE_IMPACT_POSSIBLE); } gi.trace( &tr, start, self->mins, self->maxs, end, self->s.number, MASK_SHOT, G2_NOCOLLIDE, 0); traceEnt = &g_entities[tr.entityNum]; if ( tr.entityNum < ENTITYNUM_WORLD && traceEnt->takedamage ) { G_Damage( traceEnt, self, self, dir, tr.endpos, damage, DAMAGE_NO_ARMOR|DAMAGE_NO_KNOCKBACK|DAMAGE_NO_HIT_LOC|DAMAGE_IGNORE_TEAM, MOD_LAVA, HL_NONE ); if (traceEnt->health>0) { // G_Knockdown( traceEnt, self, dir, Q_irand(200, 330), qfalse); G_Throw(traceEnt, dir, 30); } } } //////////////////////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////////////////////// void Boba_StopFlameThrower( gentity_t *self ) { if ( self->s.number < MAX_CLIENTS ) { self->client->ps.torsoAnimTimer = 0; G_StopEffect( G_EffectIndex("boba/fthrw"), self->playerModel, self->genericBolt3, self->s.number); return; } if ((NPCInfo->aiFlags&NPCAI_FLAMETHROW)) { self->NPC->aiFlags &= ~NPCAI_FLAMETHROW; self->client->ps.torsoAnimTimer = 0; TIMER_Set( self, "flameTime", 0); TIMER_Set( self, "nextAttackDelay", 0); TIMER_Set( self, "Boba_TacticsSelect", 0); // G_SoundOnEnt( self, CHAN_WEAPON, "sound/effects/flameoff.mp3" ); G_StopEffect( G_EffectIndex("boba/fthrw"), self->playerModel, self->genericBolt3, self->s.number); Boba_Printf("FlameThrower OFF"); } } //////////////////////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////////////////////// void Boba_StartFlameThrower( gentity_t *self ) { if (!(NPCInfo->aiFlags&NPCAI_FLAMETHROW)) { NPC_SetAnim( self, SETANIM_TORSO, BOTH_FORCELIGHTNING_HOLD, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD ); self->NPC->aiFlags |= NPCAI_FLAMETHROW; self->client->ps.torsoAnimTimer = BOBA_FLAMEDURATION; TIMER_Set( self, "flameTime", BOBA_FLAMEDURATION); TIMER_Set( self, "nextAttackDelay", BOBA_FLAMEDURATION); TIMER_Set( self, "nextFlameDelay", BOBA_FLAMEDURATION*2); TIMER_Set( self, "Boba_TacticsSelect", BOBA_FLAMEDURATION); G_SoundOnEnt( self, CHAN_WEAPON, "sound/weapons/boba/bf_flame.mp3" ); G_PlayEffect( G_EffectIndex("boba/fthrw"), self->playerModel, self->genericBolt3, self->s.number, self->s.origin, 1 ); Boba_Printf("FlameThrower ON"); } } //////////////////////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////////////////////// void Boba_DoFlameThrower( gentity_t *self ) { if ( self->s.number < MAX_CLIENTS ) { if ( self->client ) { if ( !self->client->ps.forcePowerDuration[FP_LIGHTNING] ) { NPC_SetAnim( self, SETANIM_TORSO, BOTH_FORCELIGHTNING_HOLD, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD ); self->client->ps.torsoAnimTimer = BOBA_FLAMEDURATION; G_SoundOnEnt( self, CHAN_WEAPON, "sound/weapons/boba/bf_flame.mp3" ); G_PlayEffect( G_EffectIndex("boba/fthrw"), self->playerModel, self->genericBolt3, self->s.number, self->s.origin, 1 ); self->client->ps.forcePowerDuration[FP_LIGHTNING] = 1; } Boba_FireFlameThrower( self ); } return; } if (!(NPCInfo->aiFlags&NPCAI_FLAMETHROW) && TIMER_Done(self, "nextAttackDelay")) { Boba_StartFlameThrower( self ); } if ( (NPCInfo->aiFlags&NPCAI_FLAMETHROW)) { Boba_FireFlameThrower( self ); } } //////////////////////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////////////////////// void Boba_DoAmbushWait( gentity_t *self) { } //////////////////////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////////////////////// void Boba_DoSniper( gentity_t *self) { if (TIMER_Done(NPC, "PickNewSniperPoint")) { TIMER_Set(NPC, "PickNewSniperPoint", Q_irand(15000, 25000)); int SniperPoint = NPC_FindCombatPoint(NPC->currentOrigin, 0, NPC->currentOrigin, CP_SNIPE|CP_CLEAR|CP_HAS_ROUTE|CP_TRYFAR|CP_HORZ_DIST_COLL, 0, -1); if (SniperPoint!=-1) { NPC_SetCombatPoint(SniperPoint); NPC_SetMoveGoal( NPC, level.combatPoints[SniperPoint].origin, 20, qtrue, SniperPoint ); } } if (Distance(NPC->currentOrigin, level.combatPoints[NPCInfo->combatPoint].origin)<50.0f) { Boba_FireDecide(); } bool IsOnAPath = !!NPC_MoveToGoal(qtrue); // Resolve Blocked Problems //-------------------------- if (NPCInfo->aiFlags&NPCAI_BLOCKED && NPC->client->moveType!=MT_FLYSWIM && ((level.time - NPCInfo->blockedDebounceTime)>3000) ) { Boba_Printf("BLOCKED: Attempting Jump"); if (IsOnAPath) { if (!NPC_TryJump(NPCInfo->blockedTargetPosition)) { Boba_Printf(" Failed"); } } } NPC_FaceEnemy(qtrue); NPC_UpdateAngles( qtrue, qtrue ); } //////////////////////////////////////////////////////////////////////////////////////// // Call This function to make Boba actually shoot his current weapon //////////////////////////////////////////////////////////////////////////////////////// void Boba_Fire() { WeaponThink(qtrue); // If Actually Fired, Decide To Apply Alt Fire And Calc Next Attack Delay //------------------------------------------------------------------------ if (ucmd.buttons&BUTTON_ATTACK) { switch (NPC->s.weapon) { case WP_ROCKET_LAUNCHER: TIMER_Set( NPC, "nextAttackDelay", Q_irand(1000, 2000)); // Occasionally Shoot A Homing Missile //------------------------------------- if (!Q_irand(0,3)) { ucmd.buttons &= ~BUTTON_ATTACK; ucmd.buttons |= BUTTON_ALT_ATTACK; NPC->client->fireDelay = Q_irand( 1000, 3000 ); } break; case WP_DISRUPTOR: TIMER_Set(NPC, "nextAttackDelay", Q_irand(1000, 4000)); // Occasionally Alt-Fire //----------------------- if (!Q_irand(0,3)) { ucmd.buttons &= ~BUTTON_ATTACK; ucmd.buttons |= BUTTON_ALT_ATTACK; NPC->client->fireDelay = Q_irand( 1000, 3000 ); } break; case WP_BLASTER: if (TIMER_Done(NPC, "nextBlasterAltFireDecide")) { if (Q_irand(0, (NPC->count*2)+3)>2) { TIMER_Set(NPC, "nextBlasterAltFireDecide", Q_irand(3000, 8000)); if (!(NPCInfo->scriptFlags&SCF_ALT_FIRE)) { Boba_Printf("ALT FIRE On"); NPCInfo->scriptFlags |= SCF_ALT_FIRE; NPC_ChangeWeapon(WP_BLASTER); // Update Delay Timers } } else { TIMER_Set(NPC, "nextBlasterAltFireDecide", Q_irand(2000, 5000)); if ( (NPCInfo->scriptFlags&SCF_ALT_FIRE)) { Boba_Printf("ALT FIRE Off"); NPCInfo->scriptFlags &=~SCF_ALT_FIRE; NPC_ChangeWeapon(WP_BLASTER); // Update Delay Timers } } } // Occasionally Alt Fire //----------------------- if (NPCInfo->scriptFlags&SCF_ALT_FIRE) { ucmd.buttons &= ~BUTTON_ATTACK; ucmd.buttons |= BUTTON_ALT_ATTACK; } break; } } } //////////////////////////////////////////////////////////////////////////////////////// // Call this function to see if Fett should fire his current weapon //////////////////////////////////////////////////////////////////////////////////////// void Boba_FireDecide( void ) { // Any Reason Not To Shoot? //-------------------------- if (!NPC || // Only NPCs !NPC->client || // Only Clients NPC->client->NPC_class!=CLASS_BOBAFETT || // Only Boba !NPC->enemy || // Only If There Is An Enemy NPC->s.weapon==WP_NONE || // Only If Using A Valid Weapon !TIMER_Done(NPC, "nextAttackDelay") || // Only If Ready To Shoot Again !Boba_CanSeeEnemy(NPC) // Only If Enemy Recently Seen ) { return; } // Now Check Weapon Specific Parameters To See If We Should Shoot Or Not //----------------------------------------------------------------------- switch (NPC->s.weapon) { case WP_ROCKET_LAUNCHER: if (Distance(NPC->currentOrigin, NPC->enemy->currentOrigin)>400.0f) { Boba_Fire(); } break; case WP_DISRUPTOR: // TODO: Add Conditions Here Boba_Fire(); break; case WP_BLASTER: // TODO: Add Conditions Here Boba_Fire(); break; } } //////////////////////////////////////////////////////////////////////////////////////// // Tactics avaliable to Boba Fett: // -------------------------------- // BTS_RIFLE, // Uses Jedi / Seeker Movement // BTS_MISSILE, // Uses Jedi / Seeker Movement // BTS_SNIPER, // Uses Special Movement Internal To This File // BTS_FLAMETHROW, // Locked In Place // BTS_AMBUSHWAIT, // Goto CP & Wait // // // Weapons available to Boba Fett: // -------------------------------- // WP_NONE (Flame Thrower) // WP_ROCKET_LAUNCHER // WP_BLASTER // WP_DISRUPTOR // //////////////////////////////////////////////////////////////////////////////////////// void Boba_TacticsSelect() { // Don't Change Tactics For A Little While //------------------------------------------ TIMER_Set(NPC, "Boba_TacticsSelect", Q_irand(8000, 15000)); int nextState = NPCInfo->localState; // Get Some Data That Will Help With The Selection Of The Next Tactic //-------------------------------------------------------------------- bool enemyAlive = (NPC->enemy->health>0); float enemyDistance = Distance(NPC->currentOrigin, NPC->enemy->currentOrigin); bool enemyInFlameRange = (enemyDistance<BOBA_FLAMETHROWRANGE); bool enemyInRocketRange = (enemyDistance>BOBA_ROCKETRANGEMIN && enemyDistance<BOBA_ROCKETRANGEMAX); bool enemyRecentlySeen = Boba_CanSeeEnemy(NPC); // Enemy Is Really Close //----------------------- if (!enemyAlive) { nextState = BTS_RIFLE; } else if (enemyInFlameRange) { // If It's Been Long Enough Since Our Last Flame Blast, Try To Torch The Enemy //----------------------------------------------------------------------------- if (TIMER_Done(NPC, "nextFlameDelay")) { nextState = BTS_FLAMETHROW; } // Otherwise, He's Probably Too Close, So Try To Get Clear Of Him //---------------------------------------------------------------- else { nextState = BTS_RIFLE; } } // Recently Saw The Enemy, Time For Some Good Ole Fighten! //--------------------------------------------------------- else if (enemyRecentlySeen) { // At First, Boba will prefer to use his blaster against the player, but // the more times he is driven away (NPC->count), he will be less likely to // choose the blaster, and more likely to go for the missile launcher nextState = (!enemyInRocketRange || Q_irand(0, NPC->count)<1)?(BTS_RIFLE):(BTS_MISSILE); } // Hmmm... Havn't Seen The Player In A While, We Might Want To Try Something Sneaky //----------------------------------------------------------------------------------- else { bool SnipePointsNear = false; // TODO bool AmbushPointNear = false; // TODO if (Q_irand(0, NPC->count)>0) { int SniperPoint = NPC_FindCombatPoint(NPC->currentOrigin, 0, NPC->currentOrigin, CP_SNIPE|CP_CLEAR|CP_HAS_ROUTE|CP_TRYFAR|CP_HORZ_DIST_COLL, 0, -1); if (SniperPoint!=-1) { NPC_SetCombatPoint(SniperPoint); NPC_SetMoveGoal( NPC, level.combatPoints[SniperPoint].origin, 20, qtrue, SniperPoint ); TIMER_Set(NPC, "PickNewSniperPoint", Q_irand(15000, 25000)); SnipePointsNear = true; } } if (SnipePointsNear && TIMER_Done(NPC, "Boba_NoSniperTime")) { TIMER_Set(NPC, "Boba_NoSniperTime", 120000); // Don't snipe again for a while TIMER_Set(NPC, "Boba_TacticsSelect", Q_irand(35000, 45000));// More patience here nextState = BTS_SNIPER; } else if (AmbushPointNear) { TIMER_Set(NPC, "Boba_TacticsSelect", Q_irand(15000, 25000));// More patience here nextState = BTS_AMBUSHWAIT; } else { nextState = (!enemyInRocketRange || Q_irand(0, NPC->count)<1)?(BTS_RIFLE):(BTS_MISSILE); } } // The Next State Has Been Selected, Now Change Weapon If Necessary //------------------------------------------------------------------ if (nextState!=NPCInfo->localState) { NPCInfo->localState = nextState; switch (NPCInfo->localState) { case BTS_FLAMETHROW: Boba_Printf("NEW TACTIC: Flame Thrower"); Boba_ChangeWeapon(WP_NONE); Boba_DoFlameThrower(NPC); break; case BTS_RIFLE: Boba_Printf("NEW TACTIC: Rifle"); Boba_ChangeWeapon(WP_BLASTER); break; case BTS_MISSILE: Boba_Printf("NEW TACTIC: Rocket Launcher"); Boba_ChangeWeapon(WP_ROCKET_LAUNCHER); break; case BTS_SNIPER: Boba_Printf("NEW TACTIC: Sniper"); Boba_ChangeWeapon(WP_DISRUPTOR); break; case BTS_AMBUSHWAIT: Boba_Printf("NEW TACTIC: Ambush"); Boba_ChangeWeapon(WP_NONE); break; } } } //////////////////////////////////////////////////////////////////////////////////////// // Tactics // // This function is called right after Update() // If returns true, Jedi and Seeker AI not used for movement // //////////////////////////////////////////////////////////////////////////////////////// bool Boba_Tactics() { if (!NPC->enemy) { return false; } // Think About Changing Tactics //------------------------------ if (TIMER_Done(NPC, "Boba_TacticsSelect")) { Boba_TacticsSelect(); } // These Tactics Require Seeker & Jedi Movement //---------------------------------------------- if (!NPCInfo->localState || NPCInfo->localState==BTS_RIFLE || NPCInfo->localState==BTS_MISSILE) { return false; } // Flame Thrower - Locked In Place //--------------------------------- if (NPCInfo->localState==BTS_FLAMETHROW) { Boba_DoFlameThrower( NPC ); } // Sniper - Move Around, And Take Shots //-------------------------------------- else if (NPCInfo->localState==BTS_SNIPER) { Boba_DoSniper( NPC ); } // Ambush Wait //------------ else if (NPCInfo->localState==BTS_AMBUSHWAIT) { Boba_DoAmbushWait( NPC ); } NPC_FacePosition( NPC->enemy->currentOrigin, qtrue); NPC_UpdateAngles(qtrue, qtrue); return true; // Do Not Use Normal Jedi Or Seeker Movement } //////////////////////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////////////////////// bool Boba_Respawn() { int cp = -1; // Try To Predict Where The Enemy Is Going //----------------------------------------- if (AverageEnemyDirectionSamples && NPC->behaviorSet[BSET_DEATH]==0) { vec3_t endPos; VectorMA(NPC->enemy->currentOrigin, 1000.0f / (float)AverageEnemyDirectionSamples, AverageEnemyDirection, endPos); cp = NPC_FindCombatPoint(endPos, 0, endPos, CP_FLEE|CP_TRYFAR|CP_HORZ_DIST_COLL, 0, -1); Boba_Printf("Attempting Predictive Spawn Point"); } // If That Failed, Try To Go Directly To The Enemy //------------------------------------------------- if (cp==-1) { cp = NPC_FindCombatPoint(NPC->enemy->currentOrigin, 0, NPC->enemy->currentOrigin, CP_FLEE|CP_TRYFAR|CP_HORZ_DIST_COLL, 0, -1); Boba_Printf("Attempting Closest Current Spawn Point"); } // If We've Found One, Go There //------------------------------ if (cp!=-1) { NPC_SetCombatPoint( cp ); NPCInfo->surrenderTime = 0; NPC->health = NPC->max_health; NPC->svFlags &=~SVF_NOCLIENT; NPC->count ++; // This is the number of times spawned G_SetOrigin(NPC, level.combatPoints[cp].origin); AverageEnemyDirectionSamples = 0; VectorClear(AverageEnemyDirection); Boba_Printf("Found Spawn Point (%d)", cp); return true; } assert(0); // Yea, that's bad... Boba_Printf("FAILED TO FIND SPAWN POINT"); return false; } //////////////////////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////////////////////// void Boba_Update() { // Never Forget The Player... Never. //----------------------------------- if (player && player->inuse && !NPC->enemy) { G_SetEnemy(NPC, player); NPC->svFlags |= SVF_LOCKEDENEMY; // Don't forget about the enemy once you've found him } // Hey, This Is Boba, He Tests The Trace All The Time //---------------------------------------------------- if (NPC->enemy) { if (!(NPC->svFlags&SVF_NOCLIENT)) { trace_t testTrace; vec3_t eyes; CalcEntitySpot( NPC, SPOT_HEAD_LEAN, eyes ); gi.trace (&testTrace, eyes, NULL, NULL, NPC->enemy->currentOrigin, NPC->s.number, MASK_SHOT, G2_NOCOLLIDE, 0); bool wasSeen = Boba_CanSeeEnemy(NPC); if (!testTrace.startsolid && !testTrace.allsolid && testTrace.entityNum == NPC->enemy->s.number) { NPCInfo->enemyLastSeenTime = level.time; NPCInfo->enemyLastHeardTime = level.time; VectorCopy(NPC->enemy->currentOrigin, NPCInfo->enemyLastSeenLocation); VectorCopy(NPC->enemy->currentOrigin, NPCInfo->enemyLastHeardLocation); } else if (gi.inPVS( NPC->enemy->currentOrigin, NPC->currentOrigin)) { NPCInfo->enemyLastHeardTime = level.time; VectorCopy(NPC->enemy->currentOrigin, NPCInfo->enemyLastHeardLocation); } if (g_bobaDebug->integer) { bool nowSeen = Boba_CanSeeEnemy(NPC); if (!wasSeen && nowSeen) { Boba_Printf("Enemy Seen"); } if (wasSeen && !nowSeen) { Boba_Printf("Enemy Lost"); } CG_DrawEdge(NPC->currentOrigin, NPC->enemy->currentOrigin, (nowSeen)?(EDGE_IMPACT_SAFE):(EDGE_IMPACT_POSSIBLE)); } } if (!NPCInfo->surrenderTime) { if ((level.time - NPCInfo->enemyLastSeenTime)>20000 && TIMER_Done(NPC, "TooLongGoneRespawn")) { TIMER_Set(NPC, "TooLongGoneRespawn", 30000); // Give him some time to get to you before trying again Boba_Printf("Gone Too Long, Attempting Respawn Even Though Not Hiding"); Boba_Respawn(); } } } // Make Sure He Always Appears In The Last Area With Full Health When His Death Script Is Turned On //-------------------------------------------------------------------------------------------------- if (!BobaHadDeathScript && NPC->behaviorSet[BSET_DEATH]!=0) { if (!gi.inPVS(NPC->enemy->currentOrigin, NPC->currentOrigin)) { Boba_Printf("Attempting Final Battle Spawn..."); if (Boba_Respawn()) { BobaHadDeathScript = true; } else { Boba_Printf("Failed"); } } } // Don't Forget To Turn Off That Flame Thrower, Mr. Fett - You're Waisting Precious Natural Gases //------------------------------------------------------------------------------------------------ if ((NPCInfo->aiFlags&NPCAI_FLAMETHROW) && (TIMER_Done(NPC, "flameTime"))) { Boba_StopFlameThrower(NPC); } // Occasionally A Jump Turns Into A Rocket Fly //--------------------------------------------- if ( NPC->client->ps.groundEntityNum == ENTITYNUM_NONE && NPC->client->ps.forceJumpZStart && !Q_irand( 0, 10 ) ) {//take off Boba_FlyStart( NPC ); } // If Hurting, Try To Run Away //----------------------------- if (!NPCInfo->surrenderTime && (NPC->health<NPC->max_health/10)) { Boba_Printf("Time To Surrender, Searching For Flee Point"); // Find The Closest Flee Point That I Can Get To //----------------------------------------------- int cp = NPC_FindCombatPoint(NPC->currentOrigin, 0, NPC->currentOrigin, CP_FLEE|CP_HAS_ROUTE|CP_TRYFAR|CP_HORZ_DIST_COLL, 0, -1); if (cp!=-1) { NPC_SetCombatPoint( cp ); NPC_SetMoveGoal( NPC, level.combatPoints[cp].origin, 8, qtrue, cp ); if (NPC->count<6) { NPCInfo->surrenderTime = level.time + Q_irand(5000, 10000) + 1000*(6-NPC->count); } else { NPCInfo->surrenderTime = level.time + Q_irand(5000, 10000); } } else { Boba_Printf(" Failure"); } } } //////////////////////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////////////////////// bool Boba_Flee() { bool EnemyRecentlySeen = ((level.time - NPCInfo->enemyLastSeenTime)<10000); bool ReachedEscapePoint = (Distance(level.combatPoints[NPCInfo->combatPoint].origin, NPC->currentOrigin)<50.0f); bool HasBeenGoneEnough = (level.time>NPCInfo->surrenderTime || (level.time - NPCInfo->enemyLastSeenTime)>400000); // Is It Time To Come Back For Some More? //---------------------------------------- if (!EnemyRecentlySeen || ReachedEscapePoint) { NPC->svFlags |= SVF_NOCLIENT; if (HasBeenGoneEnough) { if ((level.time - NPCInfo->enemyLastSeenTime)>400000) { Boba_Printf(" Gone Too Long, Attempting Respawn"); } if (Boba_Respawn()) { return true; } } else if (ReachedEscapePoint && (NPCInfo->surrenderTime - level.time)>3000) { if (TIMER_Done(NPC, "SpookPlayerTimer")) { vec3_t testDirection; TIMER_Set(NPC, "SpookPlayerTimer", Q_irand(2000, 10000)); switch(Q_irand(0, 1)) { case 0: Boba_Printf("SPOOK: Dust"); Boba_DustFallNear(NPC->enemy->currentOrigin, Q_irand(1,2)); break; case 1: Boba_Printf("SPOOK: Footsteps"); testDirection[0] = (randomLava() * 0.5f) - 1.0f; testDirection[0] += (testDirection[0]>0.0f)?(0.5f):(-0.5f); testDirection[1] = (randomLava() * 0.5f) - 1.0f; testDirection[1] += (testDirection[1]>0.0f)?(0.5f):(-0.5f); testDirection[2] = 1.0f; VectorMA(NPC->enemy->currentOrigin, 400.0f, testDirection, BobaFootStepLoc); BobaFootStepCount = Q_irand(3,8); break; } } if (BobaFootStepCount && TIMER_Done(NPC, "BobaFootStepFakeTimer")) { TIMER_Set(NPC, "BobaFootStepFakeTimer", Q_irand(300, 800)); BobaFootStepCount --; G_SoundAtSpot(BobaFootStepLoc, G_SoundIndex(va("sound/player/footsteps/boot%d", Q_irand(1,4))), qtrue); } if (TIMER_Done(NPC, "ResampleEnemyDirection") && NPC->enemy->resultspeed>10.0f) { TIMER_Set(NPC, "ResampleEnemyDirection", Q_irand(500, 1000)); AverageEnemyDirectionSamples ++; vec3_t moveDir; VectorCopy(NPC->enemy->client->ps.velocity, moveDir); VectorNormalize(moveDir); VectorAdd(AverageEnemyDirection, moveDir, AverageEnemyDirection); } if (g_bobaDebug->integer && AverageEnemyDirectionSamples) { vec3_t endPos; VectorMA(NPC->enemy->currentOrigin, 500.0f / (float)AverageEnemyDirectionSamples, AverageEnemyDirection, endPos); CG_DrawEdge(NPC->enemy->currentOrigin, endPos, EDGE_IMPACT_POSSIBLE); } } } else { NPCInfo->surrenderTime += 100; } // Finish The Flame Thrower First... //----------------------------------- if (NPCInfo->aiFlags&NPCAI_FLAMETHROW) { Boba_DoFlameThrower( NPC ); NPC_FacePosition( NPC->enemy->currentOrigin, qtrue); NPC_UpdateAngles(qtrue, qtrue); return true; } bool IsOnAPath = !!NPC_MoveToGoal(qtrue); if (!ReachedEscapePoint && NPCInfo->aiFlags&NPCAI_BLOCKED && NPC->client->moveType!=MT_FLYSWIM && ((level.time - NPCInfo->blockedDebounceTime)>1000) ) { if (!Boba_CanSeeEnemy(NPC) && Distance(NPC->currentOrigin, level.combatPoints[NPCInfo->combatPoint].origin)<200) { Boba_Printf("BLOCKED: Just Teleporting There"); G_SetOrigin(NPC, level.combatPoints[NPCInfo->combatPoint].origin); } else { Boba_Printf("BLOCKED: Attempting Jump"); if (IsOnAPath) { if (NPC_TryJump(NPCInfo->blockedTargetPosition)) { } else { Boba_Printf(" Failed"); } } else if (EnemyRecentlySeen) { if (NPC_TryJump(NPCInfo->enemyLastSeenLocation)) { } else { Boba_Printf(" Failed"); } } } } NPC_UpdateAngles( qtrue, qtrue ); return true; }
7e5fde7ab6aff0d711c7f701fc766d09df43f8a6
44eb8f36ab292c508156a38657c3f2edf8c4dbba
/SoundSample/src/ofFFT.h
aafe75c3d5534455757bf7e7f46172e0eb57218f
[]
no_license
xxmogi/ofApp
69b71b8dceb41810e5f40c30e399e81088016687
23b3346482e9efba1d97ce6fa763b09a7200b8bc
refs/heads/master
2021-01-01T06:55:25.180685
2015-08-11T04:45:23
2015-08-11T04:45:23
39,832,347
0
0
null
null
null
null
UTF-8
C++
false
false
620
h
ofFFT.h
// // ofFFT.h // SoundSample // // Created by Takashi Mogi on 2015/08/03. // // #ifndef SoundSample_ofFFT_h #define SoundSample_ofFFT_h #include <Accelerate/Accelerate.h> #include "ofMain.h" class ofFFT : public ofBaseApp{ FFTSetup setup; int size; int sizeLog2; float *buf; float *window; float *inputBuffer; float *spectrum; DSPSplitComplex fftInput; public: ofFFT(int size); ~ofFFT(); void update(float *input); void audioReceived(float * input, int bufferSize, int nChannels); float* getSpectrums(); float* getSignals(); }; #endif
dede02f4cf93f641ac490c5e61d5746a427b4b55
4efe7a24fca48842a201f081108c2b47bfd5bceb
/test/arrayAndPoint.cpp
a32ea7acfe48a9280af5b0ae6805c95284250732
[]
no_license
284794507/cpp
a2fb2a09beb7632afd87f571c11efd2907e2528c
b3e8d9de159adba9c4707fdf98bdbdc57c1c4104
refs/heads/master
2021-01-25T08:06:35.820959
2017-06-16T14:03:28
2017-06-16T14:03:28
93,711,509
0
0
null
null
null
null
UTF-8
C++
false
false
1,116
cpp
arrayAndPoint.cpp
#include<iostream> #include<array> #include<string> #include<vector> using namespace std; int main() { array<int,3> iArr={}; cout<<"The length of iArr is:"<<endl; cout<<sizeof(iArr)<<endl; int i=0; for(i=0;i<3;i++) { cout<<"iArr["<<i<<"]"<<endl; cout<<iArr[i]<<endl; } for(int p:iArr) { cout<<p<<endl; } char cArr[]="cheseburger"; cout<<"cArr"<<cArr<<endl; string str="Waldorf Salad"; cout<<"Str:"<<str<<endl; struct fish{ string fish_type; int weight; float len; }; fish fish1={"fish1",1,1.1}; cout<<"fish1.fishtype:"<<fish1.fish_type<<endl; cout<<"fish1.weight:"<<fish1.weight<<endl; cout<<"fish1.len:"<<fish1.len<<endl; enum Reponse{Yes=1,No=0,Maybe=2}; double ted=0; double* pToRed=&ted; cout<<"ted:"<<* pToRed<<endl; float trcacle[10]={1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.10}; float * p1=&trcacle[0]; cout<<"trcacle[0]:"<<*p1<<endl; cout<<"trcacle[9]:"<<*(p1+9)<<endl; cout<<"Please enter a unsighed int data:"<<endl; int iLen; cin>>iLen; int * iArr2=new int[iLen]; vector<int> iArr3(iLen); cout<<(int *) "Home of the jolly bytes"<<endl; return 0; }
2a10af89b65566e53d91f8b2624566c89204d843
9f99bf167d9d4e613a876a0113a878e499fa6f13
/SimpleRenderEngine/src/simulation/particle.h
95ef8d5d42ae13c10a427d010f2826c4a7685812
[]
no_license
chses9440611/2018-2-computerAnimation
2a9d143383fffef92e512af00e914aaa0f86bbca
c27f6287885e5b01e486f576941e88e40924be2c
refs/heads/master
2020-05-04T16:34:52.337505
2019-04-07T13:29:31
2019-04-07T13:29:31
179,281,737
0
0
null
null
null
null
UTF-8
C++
false
false
1,366
h
particle.h
#pragma once #include <Eigen/Dense> namespace simulation { class Particle { private: double mass; Eigen::Vector3d position; Eigen::Vector3d velocity; Eigen::Vector3d force; public: //========================================== // constructor/destructor //========================================== Particle(); Particle(const Particle &other); ~Particle(); //========================================== // getter //========================================== double Mass() const; Eigen::Vector3d Position() const; Eigen::Vector3d Velocity() const; Eigen::Vector3d Acceleration() const; Eigen::Vector3d Force() const; //========================================== // setter //========================================== void SetMass(const double _mass); void SetPosition(const Eigen::Vector3d &_position); void SetVelocity(const Eigen::Vector3d &_velocity); void SetAcceleration(const Eigen::Vector3d &_acceleration); void SetForce(const Eigen::Vector3d &_force); //========================================== // method //========================================== void AddPosition(const Eigen::Vector3d &a_rcPosition); void AddVelocity(const Eigen::Vector3d &a_rcVelocity); void AddAcceleration(const Eigen::Vector3d &a_rcAcceleration); void AddForce(const Eigen::Vector3d &a_rcForce); }; }
5705e031dd630ec08cfc7196b02642a8493d0e66
3238d71de8dbc086af9928ec5bce0a4fb59fd01c
/2020/12/week1/woohyeonjo/src/텍스트에디터.cpp
f94ac048a3b46d58d56a0dc8d18826089a636ed7
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
changjunpyo/stupid-week-2020
b80ea7edb776fa9c806151ede2b5f17fca68840a
1c603bc40359aeb674da9956129887e6f7c8c30a
refs/heads/master
2023-02-05T20:56:45.346635
2021-01-01T10:49:32
2021-01-01T10:49:32
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,426
cpp
텍스트에디터.cpp
// Text editor const int MAX = 700; struct Line { int len; char str[MAX]; Line * next; Line * prev; }; Line pool[MAX]; Line * head; Line * curLine; int cntR; int curC; void init(int n){ // TO DO cntR = 0; head = &pool[cntR++]; head->prev = nullptr; head->next = nullptr; head->len = 0; curLine = head; curC = 0; } void input_char(char in_char){ // TO DO if(curC < curLine->len) { for(register int i = curLine->len ; i > curC ; --i) { curLine->str[i] = curLine->str[i - 1]; } } curLine->str[curC++] = in_char; curLine->len++; } void input_newline(){ // TO DO Line * newLine = &pool[cntR++]; Line * temp = curLine->next; curLine->next = newLine; newLine->prev = curLine; newLine->next = temp; newLine->len = 0; if(temp) temp->prev = newLine; if(curC < curLine->len) { register int i; for(i = 0 ; curC + i < curLine->len ; ++i) { newLine->str[i] = curLine->str[curC + i]; } curLine->len = curC; newLine->len = i; } curLine = newLine; curC = 0; } void move_cursor(int direction){ // 0: Up, 1: Down, 2: Left, 3: Right // TO DO switch(direction) { case 0: if(curLine->prev) { curLine = curLine->prev; if(curLine->len < curC) { curC = curLine->len; } } break; case 1: if(curLine->next) { curLine = curLine->next; if(curLine->len < curC) { curC = curLine->len; } } break; case 2: if(curC > 0) { curC--; } else { if(curLine->prev) { curLine = curLine->prev; curC = curLine->len; } } break; case 3: if(curC < curLine->len) { curC++; } else { if(curLine->next) { curLine = curLine->next; curC = 0; } } break; } } char get_char(int row, int column){ register Line * line = head; for(register int i = 0 ; i < row - 1 ; ++i) { line = line->next; } return line->str[column - 1]; }
77fcf7969254767ced91a774249173d71b5ba8d1
5b5c2a73a25c9a45b40cb455041f04c03d5111d7
/duet3d_parser/simple_string.h
e8959ae4a3d660c42b6a2d80d87a3f8c0a2bfff9
[]
no_license
zapta/misc
c385a310989324b7c14fa4848b46a7fd82b1bbdb
af69fe6c592426d467a86a20fc2571f454f3e58d
refs/heads/master
2023-07-26T15:18:33.574886
2023-06-14T05:00:48
2023-06-14T05:00:48
23,773,915
97
56
null
2023-08-30T04:58:21
2014-09-07T23:37:04
C
UTF-8
C++
false
false
2,936
h
simple_string.h
// A string with fixed buffer. // // A slimmed down version of // https://github.com/dc42/PanelDueFirmware/blob/master/src/Library/Vector.hpp #ifndef SIMPLE_STRING_H_ #define SIMPLE_STRING_H_ #include "simple_vector.h" #include <string.h> // String class. This is like the vector class except that we always keep a null // terminator so that we can call c_str() on it. template <int N> class SimpleString : public SimpleVector<char, N + 1> { public: SimpleString() : SimpleVector<char, N + 1>() { this->clear(); } SimpleString(const char* s) : SimpleVector<char, N + 1>() { this->clear(); this->copy(s); } // Redefine 'capacity' so as to make room for a null terminator constexpr int capacity() const { return N; } // Redefine 'full' so as to make room for a null terminator bool full() const { return this->filled == N; } // Redefine base 'add' to add a null terminator bool add(char x); // Redefine base 'add' to add a null terminator bool add(const char* p, int n); bool add(const char* p) { add(p, strlen(p)); } // Redefine 'erase' to preserve the null terminator void erase(int pos, int count = 1) { this->SimpleVector<char, N + 1>::erase(pos, count); this->storage[this->filled] = '\0'; } // Redefine 'truncate' to preserve the null terminator void truncate(int pos) { this->SimpleVector<char, N + 1>::truncate(pos); this->storage[this->filled] = '\0'; } const char* c_str() const { return this->storage; } void clear() { this->filled = 0; this->storage[0] = '\0'; } void cat(const char* s) { while (*s != '\0' && this->filled < N) { this->storage[this->filled++] = *s++; } this->storage[this->filled] = '\0'; } void copy(const char* s) { this->clear(); this->cat(s); } template <int M> void copy(SimpleString<M> s) { copy(s.c_str()); } // Compare with a C string. If the C string is too long but the part of it we // could accommodate matches, return true. bool similar(const char* s) const { return strncmp(s, this->storage, N) == 0; } // Compare with a C string bool equals(const char* s) const { return strcmp(s, this->storage) == 0; } bool equalsIgnoreCase(const char* s) const { return strcasecmp(s, this->storage) == 0; } }; // Redefine 'add' to add a null terminator template <int N> bool SimpleString<N>::add(char x) { this->SimpleVector<char, N + 1>::add(x); const bool overflow = (this->filled == N + 1); if (overflow) { --this->filled; } this->storage[this->filled] = '\0'; return !overflow; } // Redefine 'add' to add a null terminator template <int N> bool SimpleString<N>::add(const char* p, int n) { this->SimpleVector<char, N + 1>::add(p, n); const bool overflow = (this->filled == N + 1); if (overflow) { --this->filled; } this->storage[this->filled] = '\0'; return !overflow; } #endif /* SIMPLE_STRING_H_ */
5e5e574191ec5c0ca9cdd96d3527ea35fa5c8816
de7e771699065ec21a340ada1060a3cf0bec3091
/core/src/test/org/apache/lucene/util/automaton/FiniteStringsIteratorTest.cpp
66b1db5caade3abc97114e2f05ef30bde889f1c7
[]
no_license
sraihan73/Lucene-
0d7290bacba05c33b8d5762e0a2a30c1ec8cf110
1fe2b48428dcbd1feb3e10202ec991a5ca0d54f3
refs/heads/master
2020-03-31T07:23:46.505891
2018-12-08T14:57:54
2018-12-08T14:57:54
152,020,180
7
0
null
null
null
null
UTF-8
C++
false
false
8,395
cpp
FiniteStringsIteratorTest.cpp
using namespace std; #include "FiniteStringsIteratorTest.h" namespace org::apache::lucene::util::automaton { using BytesRef = org::apache::lucene::util::BytesRef; using IntsRef = org::apache::lucene::util::IntsRef; using IntsRefBuilder = org::apache::lucene::util::IntsRefBuilder; using LuceneTestCase = org::apache::lucene::util::LuceneTestCase; using TestUtil = org::apache::lucene::util::TestUtil; using Util = org::apache::lucene::util::fst::Util; // import static // org.apache.lucene.util.automaton.Operations.DEFAULT_MAX_DETERMINIZED_STATES; void FiniteStringsIteratorTest::testRandomFiniteStrings1() { int numStrings = atLeast(100); if (VERBOSE) { wcout << L"TEST: numStrings=" << numStrings << endl; } shared_ptr<Set<std::shared_ptr<IntsRef>>> strings = unordered_set<std::shared_ptr<IntsRef>>(); deque<std::shared_ptr<Automaton>> automata = deque<std::shared_ptr<Automaton>>(); shared_ptr<IntsRefBuilder> scratch = make_shared<IntsRefBuilder>(); for (int i = 0; i < numStrings; i++) { wstring s = TestUtil::randomSimpleString(random(), 1, 200); Util::toUTF32(s.toCharArray(), 0, s.length(), scratch); if (strings->add(scratch->toIntsRef())) { automata.push_back(Automata::makeString(s)); if (VERBOSE) { wcout << L" add string=" << s << endl; } } } // TODO: we could sometimes use // DaciukMihovAutomatonBuilder here // TODO: what other random things can we do here... shared_ptr<Automaton> a = Operations::union_(automata); if (random()->nextBoolean()) { a = MinimizationOperations::minimize(a, 1000000); if (VERBOSE) { wcout << L"TEST: a.minimize numStates=" << a->getNumStates() << endl; } } else if (random()->nextBoolean()) { if (VERBOSE) { wcout << L"TEST: a.determinize" << endl; } a = Operations::determinize(a, 1000000); } else if (random()->nextBoolean()) { if (VERBOSE) { wcout << L"TEST: a.removeDeadStates" << endl; } a = Operations::removeDeadStates(a); } shared_ptr<FiniteStringsIterator> iterator = make_shared<FiniteStringsIterator>(a); deque<std::shared_ptr<IntsRef>> actual = getFiniteStrings(iterator); assertFiniteStringsRecursive(a, actual); if (!strings->equals(unordered_set<>(actual))) { wcout << L"strings.size()=" << strings->size() << L" actual.size=" << actual.size() << endl; deque<std::shared_ptr<IntsRef>> x = deque<std::shared_ptr<IntsRef>>(strings); sort(x.begin(), x.end()); deque<std::shared_ptr<IntsRef>> y = deque<std::shared_ptr<IntsRef>>(actual); sort(y.begin(), y.end()); int end = min(x.size(), y.size()); for (int i = 0; i < end; i++) { wcout << L" i=" << i << L" string=" << toString(x[i]) << L" actual=" << toString(y[i]) << endl; } fail(L"wrong strings found"); } } void FiniteStringsIteratorTest::testFiniteStringsBasic() { shared_ptr<Automaton> a = Operations::union_(Automata::makeString(L"dog"), Automata::makeString(L"duck")); a = MinimizationOperations::minimize(a, DEFAULT_MAX_DETERMINIZED_STATES); shared_ptr<FiniteStringsIterator> iterator = make_shared<FiniteStringsIterator>(a); deque<std::shared_ptr<IntsRef>> actual = getFiniteStrings(iterator); assertFiniteStringsRecursive(a, actual); TestUtil::assertEquals(2, actual.size()); shared_ptr<IntsRefBuilder> dog = make_shared<IntsRefBuilder>(); Util::toIntsRef(make_shared<BytesRef>(L"dog"), dog); assertTrue(find(actual.begin(), actual.end(), dog->get()) != actual.end())); shared_ptr<IntsRefBuilder> duck = make_shared<IntsRefBuilder>(); Util::toIntsRef(make_shared<BytesRef>(L"duck"), duck); assertTrue(find(actual.begin(), actual.end(), duck->get()) != actual.end())); } void FiniteStringsIteratorTest::testFiniteStringsEatsStack() { std::deque<wchar_t> chars(50000); TestUtil::randomFixedLengthUnicodeString(random(), chars, 0, chars.size()); wstring bigString1 = wstring(chars); TestUtil::randomFixedLengthUnicodeString(random(), chars, 0, chars.size()); wstring bigString2 = wstring(chars); shared_ptr<Automaton> a = Operations::union_( Automata::makeString(bigString1), Automata::makeString(bigString2)); shared_ptr<FiniteStringsIterator> iterator = make_shared<FiniteStringsIterator>(a); deque<std::shared_ptr<IntsRef>> actual = getFiniteStrings(iterator); TestUtil::assertEquals(2, actual.size()); shared_ptr<IntsRefBuilder> scratch = make_shared<IntsRefBuilder>(); Util::toUTF32(bigString1.toCharArray(), 0, bigString1.length(), scratch); assertTrue(find(actual.begin(), actual.end(), scratch->get()) != actual.end())); Util::toUTF32(bigString2.toCharArray(), 0, bigString2.length(), scratch); assertTrue(find(actual.begin(), actual.end(), scratch->get()) != actual.end())); } void FiniteStringsIteratorTest::testWithCycle() { expectThrows(invalid_argument::typeid, [&]() { shared_ptr<Automaton> a = (make_shared<RegExp>(L"abc.*", RegExp::NONE))->toAutomaton(); shared_ptr<FiniteStringsIterator> iterator = make_shared<FiniteStringsIterator>(a); getFiniteStrings(iterator); }); } void FiniteStringsIteratorTest::testSingletonNoLimit() { shared_ptr<Automaton> a = Automata::makeString(L"foobar"); shared_ptr<FiniteStringsIterator> iterator = make_shared<FiniteStringsIterator>(a); deque<std::shared_ptr<IntsRef>> actual = getFiniteStrings(iterator); TestUtil::assertEquals(1, actual.size()); shared_ptr<IntsRefBuilder> scratch = make_shared<IntsRefBuilder>(); Util::toUTF32((wstring(L"foobar")).toCharArray(), 0, 6, scratch); assertTrue(find(actual.begin(), actual.end(), scratch->get()) != actual.end())); } void FiniteStringsIteratorTest::testShortAccept() { shared_ptr<Automaton> a = Operations::union_(Automata::makeString(L"x"), Automata::makeString(L"xy")); a = MinimizationOperations::minimize(a, DEFAULT_MAX_DETERMINIZED_STATES); shared_ptr<FiniteStringsIterator> iterator = make_shared<FiniteStringsIterator>(a); deque<std::shared_ptr<IntsRef>> actual = getFiniteStrings(iterator); TestUtil::assertEquals(2, actual.size()); shared_ptr<IntsRefBuilder> x = make_shared<IntsRefBuilder>(); Util::toIntsRef(make_shared<BytesRef>(L"x"), x); assertTrue(find(actual.begin(), actual.end(), x->get()) != actual.end())); shared_ptr<IntsRefBuilder> xy = make_shared<IntsRefBuilder>(); Util::toIntsRef(make_shared<BytesRef>(L"xy"), xy); assertTrue(find(actual.begin(), actual.end(), xy->get()) != actual.end())); } void FiniteStringsIteratorTest::testSingleString() { shared_ptr<Automaton> a = make_shared<Automaton>(); int start = a->createState(); int end = a->createState(); a->setAccept(end, true); a->addTransition(start, end, L'a', L'a'); a->finishState(); shared_ptr<Set<std::shared_ptr<IntsRef>>> accepted = TestOperations::getFiniteStrings(a); TestUtil::assertEquals(1, accepted->size()); shared_ptr<IntsRefBuilder> intsRef = make_shared<IntsRefBuilder>(); intsRef->append(L'a'); assertTrue(accepted->contains(intsRef->toIntsRef())); } deque<std::shared_ptr<IntsRef>> FiniteStringsIteratorTest::getFiniteStrings( shared_ptr<FiniteStringsIterator> iterator) { deque<std::shared_ptr<IntsRef>> result = deque<std::shared_ptr<IntsRef>>(); for (IntsRef finiteString; (finiteString = iterator->next()) != nullptr;) { result.push_back(IntsRef::deepCopyOf(finiteString)); } return result; } void FiniteStringsIteratorTest::assertFiniteStringsRecursive( shared_ptr<Automaton> automaton, deque<std::shared_ptr<IntsRef>> &actual) { shared_ptr<Set<std::shared_ptr<IntsRef>>> expected = AutomatonTestUtil::getFiniteStringsRecursive(automaton, -1); // Check that no string is emitted twice. TestUtil::assertEquals(expected->size(), actual.size()); TestUtil::assertEquals(expected, unordered_set<>(actual)); } wstring FiniteStringsIteratorTest::toString(shared_ptr<IntsRef> ints) { shared_ptr<BytesRef> br = make_shared<BytesRef>(ints->length); for (int i = 0; i < ints->length; i++) { br->bytes[i] = static_cast<char>(ints->ints[i]); } br->length = ints->length; return br->utf8ToString(); } } // namespace org::apache::lucene::util::automaton
3c44937a0afefe03a94099292d890dabfbf8b91d
9460e4d39ea0a645071a222c467712c7682b7861
/c++/20140222/20140222/20140222.cpp
810cb7e88072530d3c3165f7e32a4577252e7d26
[]
no_license
Aiyuan-h/programming-language
c337a0ce779737322ad6134b8851d07791ca76ed
09d9c090d6fff09935fd426b2a8901fe7197ca11
refs/heads/master
2021-01-01T15:41:17.156121
2015-07-21T07:00:00
2015-07-21T07:00:00
39,425,455
0
0
null
null
null
null
UTF-8
C++
false
false
323
cpp
20140222.cpp
#include <iostream> #include<cstring> int main() { using namespace std; char ch; int space =0; int total =0; cin.get (ch); while(ch!='.') { if(ch==' ') ++space; ++total; cin.get(ch); } cout<<space<<"space,"<<total; // cout<<""endl<<cout<<"\n"; cin.get(); cin.get(); return 0; }
c7da3d864c3ec2aacfc8333d16b3383751c5212a
cb142069b8e6d605458658385df36ee85ec05561
/Rafagan/Projeto Contra/Interfaces/Level.h
a9413788b8302d66f763140f58cde754e98c6f82
[]
no_license
rafagan/contra-nes-first-level
14a5ba4be705d6571e2f65151718e23a9bb460a6
2d7c94067a9dc85b37f9eda050e73d561ad3859f
refs/heads/master
2020-05-19T14:55:50.108864
2019-05-05T19:29:25
2019-05-05T19:29:25
185,072,684
0
0
null
null
null
null
UTF-8
C++
false
false
311
h
Level.h
#pragma once #include <memory> #include "MapUtil.h" //#include "../Enemies/EnemiesManager.h" class EnemiesManager; class Level { public: virtual ~Level(){}; virtual std::shared_ptr<MapUtil> getMap() = 0; virtual EnemiesManager* getEnemiesManager() = 0; virtual unsigned int getNumberOfPlayers() = 0; };
22356910ba7e701ee1cec9935a9e83a407e37188
5faa619a85b44c4e38f84300364b612acb6e8ee7
/inc/file_reader.h
3243da4c5b6795eaf2a1ba2bea11f1f919030369
[ "MIT" ]
permissive
hailpam/experimental
3feaa748aa8156c200deed991f71a961fc2d1d81
e973531be4c2cdce97329ff5f0651d83195e8b6f
refs/heads/master
2021-06-01T11:34:46.496411
2020-10-10T14:14:09
2020-10-10T14:14:09
19,175,429
0
0
null
null
null
null
UTF-8
C++
false
false
1,673
h
file_reader.h
/** * @file file_reader.h * * File Reader facility. It reads a file and provides a tokenization service. * Tokens can be read in natural or reverse order. * * @brief * * @author Paolo Maresca <plo.maresca@gmail.com> * @version 0.1 */ // $Log$ #ifndef _FILE_READER_H #define _FILE_READER_H #include <string> #include <sstream> #include <fstream> #include <set> #include <list> #include <iostream> using namespace std; class FileReader { public: /** * Default Constructor. */ FileReader(); /** * Constructor with 1 argument: debug level. * * @param isDebug True whether the debug is activated */ FileReader(bool isDebug); /** * Default Distructor. */ ~FileReader(); /** * Read file. * * @param fileName Absolute identifier * * @return True iff the file has successfully read */ bool readFile(const char* fileName); /** * Print the content. */ void printContent(); /** * Tokenize the stream read from file. */ void tokenize(); /** * List the tokens. */ void listTokens(); /** * Inverse list the tokens. */ void reverseListTokens(); /** * Set the token. */ void setToken(const char& token); private: bool isDebug; bool inited; char token; stringstream content; set<char> toBeStripped; list<string> tokens; }; #endif /* _FILE_READER_H */
5475da129ff8554d43203a196ea22379039cb045
11ec37462cefceb73c161bc8a658fa4497ab972e
/tests/unit/styleParamTests.cpp
c447092943ce511ea100fc8f328c78e9ee3eaa95
[ "MIT" ]
permissive
pilgarlicx/tangram-es
488e5c57595cd2cfa58274698722b5dd37ec191f
a2403239a62c6c8c1c0131bfc17bd5c0ba2d378b
refs/heads/main
2023-07-01T16:26:11.505213
2021-07-28T16:34:40
2021-07-28T16:34:40
391,446,316
1
0
MIT
2021-07-31T19:25:31
2021-07-31T19:25:30
null
UTF-8
C++
false
false
2,796
cpp
styleParamTests.cpp
#include "catch.hpp" #include "scene/styleParam.h" #include "glm/vec3.hpp" #include "yaml-cpp/yaml.h" using namespace Tangram; TEST_CASE("Correctly parse valid ValueUnitPair", "[StyleParam]") { float epsilon = 1e-6f; StyleParam::ValueUnitPair result; struct ValueUnitTestPair { std::string input; StyleParam::ValueUnitPair expected; }; auto testPair = GENERATE( ValueUnitTestPair{"2px", {2.f, Unit::pixel}}, ValueUnitTestPair{"3.14s", {3.14f, Unit::seconds}}, ValueUnitTestPair{"14 ms", {14.f, Unit::milliseconds}}, ValueUnitTestPair{"99.99 m", {99.99f, Unit::meter}}, ValueUnitTestPair{"55%", {55.f, Unit::percentage}}, ValueUnitTestPair{"404", {404.f, Unit::none}} ); DYNAMIC_SECTION("Input string: " << testPair.input) { CHECK(StyleParam::parseValueUnitPair(testPair.input, result)); CHECK(result.unit == testPair.expected.unit); CHECK_THAT(result.value, Catch::WithinAbs(testPair.expected.value, epsilon)); } } TEST_CASE("Correctly reject invalid ValueUnitPair", "[StyleParam]") { StyleParam::ValueUnitPair result; auto invalid = GENERATE( std::string(""), std::string("null"), std::string("px"), std::string("m22") ); DYNAMIC_SECTION("Input string: " << invalid) { CHECK_FALSE(StyleParam::parseValueUnitPair(invalid, result)); } } TEST_CASE("Correctly parse valid Vec3", "[StyleParam]") { float epsilon = 1e-6f; UnitVec<glm::vec3> result; auto input = YAML::Load("[0m, 40px, 8]"); REQUIRE(input.IsSequence()); CHECK(StyleParam::parseVec3(input, UnitSet{Unit::none, Unit::meter, Unit::pixel}, result)); CHECK(result.units[0] == Unit::meter); CHECK(result.units[1] == Unit::pixel); CHECK(result.units[2] == Unit::none); CHECK_THAT(result.value[0], Catch::WithinAbs(0.f, epsilon)); CHECK_THAT(result.value[1], Catch::WithinAbs(40.f, epsilon)); CHECK_THAT(result.value[2], Catch::WithinAbs(8.f, epsilon)); } TEST_CASE("Correctly reject invalid Vec3", "[StyleParam]") { UnitVec<glm::vec3> result; SECTION("Not enough elements") { auto input = YAML::Load("[0m, 40px]"); CHECK_FALSE(StyleParam::parseVec3(input, UnitSet{Unit::none, Unit::meter, Unit::pixel}, result)); } SECTION("Invalid numbers") { auto input = YAML::Load("[0m, px, 100]"); CHECK_FALSE(StyleParam::parseVec3(input, UnitSet{Unit::none, Unit::meter, Unit::pixel}, result)); } SECTION("Invalid units") { auto input = YAML::Load("[0m, 40px, 66s]"); CHECK_FALSE(StyleParam::parseVec3(input, UnitSet{Unit::none, Unit::meter, Unit::pixel}, result)); } }
04b7d56399a6937d111c32895dd78375ee91a7a6
48ebd56aeb54af86bcf850bed01abe98ff9a314d
/Problems/Solved/Source/Proj_56.cpp
26929f4c0ed0fe4146dc6f008caba4ae21bc4cd6
[]
no_license
woodylaurence/ProjectEuler-CPlusPlus
f2188e1fe937afa18f4f668d5fa6d053183b2eb4
25371e05d921eb0bb86a72d9639e4c0a04bddfe9
refs/heads/master
2021-05-29T03:34:06.215063
2015-06-27T09:37:52
2015-06-27T09:37:52
null
0
0
null
null
null
null
UTF-8
C++
false
false
669
cpp
Proj_56.cpp
/* * Proj_56.cpp * * Created on: Aug 19, 2012 * Author: Laurence * * Problem: Find maximum digital sum of a^b for 1 <= a,b <= 100 * * NOTE: REQUIRES bigInt.cpp TO RUN */ #include "BigInt.hpp" class Prob56 { int main(void) { throw "Needs reimplementing"; /*int maxDigitalSum = 0; BigInt tmpNumber; for (int a = 2; a <= 100; a++) { cout << a << endl; for (int b = 2; b <= 100; b++) { tmpNumber = BigInt::power(a, b); if (tmpNumber.sumDigits() > maxDigitalSum) { maxDigitalSum = tmpNumber.sumDigits(); } } } cout << "Maximum digital sum: " << maxDigitalSum << endl; return 0;*/ } };
10eb719b23dd6ef8b50c33eed631f4ea60eeab98
5d75eb58dd2fd52fa6b5669883abfa2f09a674e3
/wasapi/Graph.h
421519283816d4fce1b05b361170bef37df34677
[ "MIT" ]
permissive
jackyxinli/wasapi-cli
25af385c60375d994d01288bf342d99644db9382
c926cff0691ce7d81e7560b1fceefe5463242dad
refs/heads/master
2022-10-24T10:59:37.493414
2017-10-14T16:04:57
2017-10-14T16:04:57
37,639,832
0
0
null
2015-06-18T05:43:30
2015-06-18T05:43:28
C++
UTF-8
C++
false
false
1,716
h
Graph.h
#pragma once #include "com_iterator.h" #include "Filter.h" namespace DirectShow { class Graph { public: typedef com_iterator<Filter, IBaseFilter, IEnumFilters> iterator; Graph(const IID& clsid, bool addToRot); ~Graph(); void Abort(); void AddFilter(Filter& filter, LPCWSTR name); void AddFilter(Filter& filter, const std::wstring& name); Filter AddSourceFilter(LPCWSTR fileName, LPCWSTR filterName); Filter AddSourceFilter(LPCWSTR fileName, const std::wstring& filterName); Filter AddSourceFilter(const std::wstring& fileName, LPCWSTR filterName); Filter AddSourceFilter(const std::wstring& fileName, const std::wstring& filterName); iterator begin(); void Connect(Pin& pinOut, Pin& pinIn); void ConnectDirect(Pin& pinOut, Pin& pinIn); void Disconnect(Pin& pin); iterator end(); Filter FindFilter(LPCWSTR name); Filter FindFilter(const std::wstring& name); long GetEvent(); HANDLE GetEventHandle() const; void Pause(); void Reconnect(Pin& pin); void RemoveFilter(Filter& filter); void Render(Pin& pin); void RenderFile(LPCWSTR fileName); void RenderFile(const std::wstring& fileName); void Run(); void SetLogFile(DWORD_PTR fileHandle); void Stop(); std::wstring ToString() const; long WaitForCompletion(); operator IGraphBuilder*(); operator const IGraphBuilder*() const; operator IMediaControl*(); operator const IMediaControl*() const; Filter operator [](const std::wstring& name); Filter operator [](LPCWSTR name); private: CComPtr<IGraphBuilder> graphBuilder; CComPtr<IMediaControl> mediaControl; CComPtr<IMediaEvent> mediaEvent; DWORD rotEntry; static HANDLE sigint; }; }
9174565f6d4c05c6a8d9c5fbcb46b5db0204a361
dd83e7fdce5c8d8b917fc2877b3e891878fb2a7a
/Don't Rebound/3DPrograming_ver3-master/Obj3D.h
437eabedfac716e0519f9abb889d56fd0e1ec608
[]
no_license
MizunoKeita/Revound
a365de939480d270c50aa685c2b586c6ff287364
c88de20dada747928b2c19e28605bf13fe0968dd
refs/heads/master
2020-03-29T18:28:13.921342
2018-09-25T15:36:21
2018-09-25T15:36:21
150,214,806
0
0
null
2018-09-28T05:55:48
2018-09-25T05:58:23
C++
SHIFT_JIS
C++
false
false
851
h
Obj3D.h
#pragma once using namespace DirectX; using namespace DirectX::SimpleMath; class Game; class Obj3D { protected: //ゲームオブジェクトへのポインタ Game* m_game; //モデルハンドル Model* m_model; //位置 Vector3 m_position; //回転 Quaternion m_rotation; //ワールド行列 Matrix m_world; public: //コンストラクタ Obj3D(); //更新 virtual bool Update(float elapsedTime); //描画 virtual void Render(); //ゲームオブジェクトを設定する関数 void SetGame(Game* game) { m_game = game; } //モデルハンドルを設定する関数 void SetModel(Model* model) { m_model = model; } //位置を設定する関数 void SetPosirion(Vector3 position) { m_position = position; } //回転を設定する関数 void SetRotation(Quaternion rotation) { m_rotation = rotation; } };
b1a7c1208d6c7a863a57d0d77729fcab800f6e3f
4d5fc41a348f065f27d2c06305f31bb2e27b806e
/cpp/harmonic/harmonic.cpp
0b92c4246f237289dc6ad624ccd67fe643dd9983
[]
no_license
sykim9587/Linux_src
4c81a22ba26f8657caaf13cd7a8ea2c8b178ec52
8b0201226eff580f6b33a8818842384a4f368aeb
refs/heads/master
2022-12-18T04:30:01.130153
2020-09-13T07:30:08
2020-09-13T07:30:08
276,586,646
1
1
null
null
null
null
UTF-8
C++
false
false
429
cpp
harmonic.cpp
#include <iostream> #include <fstream> int main() { std::ofstream out("iotest.out"); if(!out){ std::cerr << "can't open file" <<std::endl; } for(int i = 1; i<= 100; ++i) out<<1.0/i << std::endl; double d; double sum = 0.0; std::ifstream in("iotest.out"); if(!in){ std::cerr << "can't open fil" << std::endl; return -1; } while(in >> d) sum += d; std::cout<<"sum: "<<sum <<std::endl; return 0; }
6101f156955baddba2f605c1a3ef8d24af544bac
9f1d318b453d62045495432c058b7857306857ac
/LogAnalyzer/tuple.hpp
14857ef3c7dd88a55d50084ccbc30484e3404711
[]
no_license
gmaisto/PGLogAnalyzer
82008da0121881bd3597f910412cad231ea8792f
7f44783594bc9ab9947dd193c53f05989d96420e
refs/heads/master
2020-12-25T14:49:35.705532
2016-08-28T15:38:10
2016-08-28T15:38:10
66,775,267
0
0
null
null
null
null
UTF-8
C++
false
false
2,358
hpp
tuple.hpp
// // tuple.hpp // LogAnalyzer // // Created by Luigi Maisto on 06/08/2016. // Copyright © 2016 Luigi Maisto. All rights reserved. // #ifndef tuple_hpp #define tuple_hpp #include "statement.hpp" #include <vector> #include <boost/accumulators/accumulators.hpp> #include <boost/accumulators/statistics/stats.hpp> #include <boost/accumulators/statistics/mean.hpp> #include <boost/accumulators/statistics/median.hpp> #include <boost/accumulators/statistics/variance.hpp> #include <boost/accumulators/statistics/min.hpp> #include <boost/accumulators/statistics/max.hpp> #include <boost/bind.hpp> #include <boost/ref.hpp> using namespace boost::accumulators; namespace Tuple { struct Stats { std::size_t samples; float mean; float median; float variance; float min; float max; }; class Tuple { public: Tuple(Statement const& st = {}): statement(st), _count(0L) { } long getCount() {return _count;} std::vector<float>& getTimings() { std::sort(timings.begin(), timings.end(), std::greater<float>()); return timings; } void addTiming(float const& runtime) {timings.push_back(runtime);} Statement getStatement() {return statement;} void addOneToCount() { _count += 1; } Stats getStatistics() { accumulator_set<float, features<tag::count, tag::min, tag::max, tag::mean, tag::variance, tag::median(with_p_square_quantile)> > acc; for_each(timings.begin(), timings.end(), boost::bind<void>(boost::ref(acc), _1)); stats.samples = count(acc); stats.median = median(acc); stats.variance = variance(acc); stats.max = max(acc); stats.min = min(acc); stats.mean = mean(acc); return stats; } /* std::tuple<std::size_t, float, float, float, float, float> getStats() { accumulator_set<float, features<tag::count, tag::min, tag::max, tag::mean, tag::variance, tag::median(with_p_square_quantile)> > acc; for_each(timings.begin(), timings.end(), boost::bind<void>(boost::ref(acc), _1)); return std::make_tuple(count(acc), min(acc), max(acc), mean(acc), variance(acc), median(acc)); }*/ private: Statement statement; long _count; std::vector<float> timings; Stats stats; }; }; #endif /* tuple_hpp */
b548a25644b1e69a55be158cc6611dd407b8a0af
46cce0f5350dd7bef7a22bb0a1246f003f40916c
/ui/widgets/defect/scannerdefectregistrationpage.h
49a1e4657d7558ce7f7d7f79e96475e5cf6c6ad2
[]
no_license
veodev/av_training
6e65d43b279d029c85359027b5c68bd251ad24ff
ecb8c3cdc58679ada38c30df36a01751476f9015
refs/heads/master
2020-04-28T22:23:39.485893
2019-09-23T13:16:29
2019-09-23T13:16:29
175,615,879
0
0
null
null
null
null
UTF-8
C++
false
false
781
h
scannerdefectregistrationpage.h
#ifndef SCANNERDEFECTREGISTRATIONPAGE_H #define SCANNERDEFECTREGISTRATIONPAGE_H #include <QWidget> class ScannerDefectRegistrationPage : public QWidget { Q_OBJECT public: explicit ScannerDefectRegistrationPage(QWidget* parent = Q_NULLPTR); virtual void switchState(int state) = 0; virtual int getWorkRail() = 0; virtual int getEdge() = 0; virtual int getHSize() = 0; virtual int getLSize() = 0; virtual int getDSize() = 0; virtual int getSpeedLimit() = 0; virtual QString getDefectCode() = 0; virtual QString getLink() = 0; virtual QString getComment() = 0; virtual void resetPage() = 0; signals: void startWork(); void nextHead(); void saveResults(); public slots: }; #endif // SCANNERDEFECTREGISTRATIONPAGE_H
fa4dcb144a6ed58661c799e2b71a001c7bb87b76
1e8afd2c1a0b1365889db9f229e97f14870faa26
/2daSemanaInformaticaYComputacionCUCEI/B/b_TeamWarriors.cpp
101c9fc62198118d5760dafa424dbcee68b2de1a
[]
no_license
club-de-algoritmia-cuvalles/Concursos
588e20174af2ad96aa0498922959b1527707b633
fb92bdf240a2842279b97158a53f1476b61e5584
refs/heads/master
2020-05-05T09:17:22.628237
2019-11-30T04:47:30
2019-11-30T04:47:30
179,897,772
1
1
null
2019-11-28T14:30:08
2019-04-06T23:30:31
Python
UTF-8
C++
false
false
671
cpp
b_TeamWarriors.cpp
//Team Warriors Problem B //No Send #include <iostream> #include <string.h> using namespace std; int main() { int numFra,lim,cont=0; cin>>numFra; char frases[numFra][100]; char faltantes[numFra][100]; int pangram[numFra]; for (int i = 0; i < numFra; ++i){ cin>>frases[i]; } for (int i = 0; i < numFra; ++i){ for (int j= 0; j < strlen(frases[j]); ++j){ if (!(frases[i][j]>='a' && frases[i][j]<='z')){ faltantes[i][j]=frases[i][j]; pangram[i]=0; } else{ pangram[i]=1; } } } for (int i = 0; i < numFra; ++i){ if (pangram[i]==0) { cout<<"missing "<<faltantes[i]<<endl; } else{ cout<<"pangram"<<endl; } } return 0; }
c68f41ebfd2e80c6b0f1766efa65e53b4c903fb3
0562999713603cd16658adde32a07a2c52954692
/src/WeightedFunction.cpp
3d96f5846870db1e32d84d1ae10eee20ab7baebc
[]
no_license
kevinguoqi/DiverseKNNCompetitors
be3b911df8bfad097e74ef7c68559a07dd09d90d
3badf95b34b1e796df5c20ceca9b3dcc220703ae
refs/heads/master
2020-07-29T13:43:37.349599
2016-11-14T04:12:03
2016-11-14T04:12:03
73,665,417
0
0
null
null
null
null
UTF-8
C++
false
false
479
cpp
WeightedFunction.cpp
/* * WeightedFunction.cpp * * Created on: Oct 4, 2016 * Author: zhengyuxin */ #include "WeightedFunction.h" #include <math.h> WeightedFunction::WeightedFunction( int dim, double alpha ) { this->dim = dim; this->alpha = alpha; for ( int i = 0; i < dim; i++ ) { double weight = pow( alpha, i ) * ( 1 - alpha ) / ( 1 - pow( alpha, dim ) ); weights.push_back( weight ); } } WeightedFunction::~WeightedFunction() { // TODO Auto-generated destructor stub }
9da61550b666a97a8dd20f65689caf4735b3512e
6ab209e3109f8e434def49345f97010f3853625e
/src/hud/HUD.cpp
bce57441885f6cc54823edab6da0231e462d0d83
[ "MIT" ]
permissive
nickfourtimes/overbourn
2425d3bf2b60223c401a602ce49f735408fe8c04
4fe0260222c454d9651b9fd6a5597148bdf0900d
refs/heads/main
2022-10-06T09:24:33.959649
2020-06-09T12:37:43
2020-06-09T12:37:43
270,692,723
1
0
null
null
null
null
UTF-8
C++
false
false
1,905
cpp
HUD.cpp
/** * HUD.cpp * * Author: nrudzicz * Created on: 28-May-2009 */ #include <iostream> #include "common.h" #include "hud/HUD.h" using namespace std; const int FONT_SIZE = 40; const int MASK_ALPHA = 75; // 0 is transparent, 255 is opaque /************************************************************************************************** {CON|DE}STRUCTORS */ HUD::HUD() { // get our main font if (TTF_Init() != 0) { cout << "ERROR: Initialising TTF: " << TTF_GetError() << endl; exit(RETURN_ERROR); } LoadMainFont(); return; } HUD::~HUD() { SDL_FreeSurface(maskSurface); return; } /************************************************************************************************** METHODS */ void HUD::LoadMainFont() { mainFont = TTF_OpenFont("assets/fonts/VeniceClassic/VeniceClassic.ttf", FONT_SIZE); if (!mainFont) { cout << "ERROR: HUD could not open main font!" << endl; exit(RETURN_ERROR); } return; } void HUD::CreateMaskSurface() { SDL_Surface* temp = SDL_CreateRGBSurface(SDL_SWSURFACE, WINDOW_SIZE, WINDOW_SIZE, SCREEN_BPP, RMASK, GMASK, BMASK, AMASK); SDL_SetAlpha(temp, SDL_SRCALPHA, MASK_ALPHA); maskSurface = SDL_DisplayFormat(temp); SDL_FreeSurface(temp); return; } HUD* HUD::Instance() { static HUD m_instance; return &m_instance; } void HUD::Init() { // create our surfaces CreateMaskSurface(); return; } bool HUD::IsDisplaying() { return messageQueue.size() >= 1; } bool HUD::IsLastMessage() { return messageQueue.size() == 1; } TTF_Font* HUD::GetMainFont() const { return mainFont; } SDL_Surface* HUD::GetMaskSurface() { return maskSurface; } void HUD::PushMessage(HUDMessage* msg) { messageQueue.push(msg); return; } HUDMessage* HUD::Front() { return messageQueue.front(); } void HUD::PopMessage() { if (messageQueue.empty()) { return; } // get rid of our previous message messageQueue.pop(); return; }
9d349abba1425816fc42b3a7da65f146983acc28
387fcd525c75f8dab2b2c4ed7eeffce2067e7148
/simvis/scene.cpp
ae9bbfa929b03787e4cac25be843a3381aad75f5
[ "Apache-2.0" ]
permissive
tgeijten/simvis
e21c5ba4c054c384fafcd50db19fa3f1c6e8b687
4a0a6def0855f938a8a2506211cc42e75b351b68
refs/heads/master
2021-01-09T11:35:56.144261
2019-03-19T13:13:19
2019-03-19T13:13:19
62,389,610
0
2
Apache-2.0
2019-01-11T10:56:00
2016-07-01T11:52:49
C++
UTF-8
C++
false
false
1,711
cpp
scene.cpp
#include "scene.h" #include "osgShadow/ShadowedScene" #include "osgShadow/SoftShadowMap" #include "osg_tools.h" #include "osgDB/ObjectCache" #include "osgDB/ReadFile" #include "osg/LightModel" namespace vis { scene::scene( bool use_shadows ) : node( nullptr ) { if ( use_shadows ) { auto s_root = new osgShadow::ShadowedScene; /// setup shadows auto sm = new osgShadow::SoftShadowMap; sm->setTextureSize( osg::Vec2s( 1024, 1024 ) ); s_root-> setShadowTechnique( sm ); //sm->setAmbientBias( osg::Vec2( 0.5f, 0.5f ) ); auto ss = new osgShadow::ShadowSettings; ss->setCastsShadowTraversalMask( OsgCastShadowMask ); ss->setReceivesShadowTraversalMask( OsgReceiveShadowMask ); // this one doesn't do anything in osg s_root->setShadowSettings( ss ); node_ = s_root; } else { node_= new osg::Group; } // enable lighting node_->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::ON ); // set default lighting osg::ref_ptr< osg::Material > mat = new osg::Material; mat->setSpecular( osg::Material::FRONT, osg::Vec4( 1, 1, 1, 1 ) ); mat->setEmission( osg::Material::FRONT, osg::Vec4( 0, 0, 0, 1 ) ); mat->setShininess( osg::Material::FRONT, 25.0 ); mat->setColorMode( osg::Material::AMBIENT_AND_DIFFUSE ); node_->getOrCreateStateSet()->setAttribute( mat ); // set ambient intensity (for some reason, this requires yet another light class) osg::ref_ptr< osg::LightModel > lm = new osg::LightModel; lm->setAmbientIntensity( osg::Vec4( 0.333, 0.333, 0.333, 1 ) ); node_->getOrCreateStateSet()->setAttribute( lm ); } vis::light scene::add_light( const vec3f& pos, const color& c ) { return light( *this, pos, c ); } }
435100952cfe002491e4d9a0d66c9a6b6bb8644a
a1c7d34d1108f47d98c9ec3b79ffca6b4221927c
/Flicker_Fusion_Theshold_v2/src/main.cpp
cd46276c86115170590bda5409ea208e0e83555e
[]
no_license
FStilwell/0_Flicker_Fusion_Threshold
97c5012baa882e12fb0169fa978e635dd2ff4230
5c5a3fe85e4f41eb670b64efb8dbdb5055537f8d
refs/heads/master
2022-11-04T22:58:50.680634
2020-06-20T00:51:20
2020-06-20T00:51:20
262,011,034
0
0
null
null
null
null
UTF-8
C++
false
false
3,185
cpp
main.cpp
/* Flynn Stilwell May 2020 This is the finished code for the Flicker Fusion Threshold project. A potentiometer is used to alter the frequency of blinking led. One the flicker fusion threshold is found, the user can press the button and the serial monitor will display the chosen frequency. */ #include <Arduino.h> #define potPin 14 #define ledPin 13 #define buttonPin 12 //Declare Variables const int32_t debounceTime_ms = 150; bool buttonState = 0; uint32_t scanTime = 0; volatile bool ledState = 0; float freq = 0; //Variables and Constants for Mapping uint32_t inputPot = 0; const uint32_t inputMin = 0; const uint32_t inputMax = 102; uint32_t outputPeriod = 0; const uint32_t outputPeriodMin = 1; //Minimum period of 1 to avoid dividing by 0 later const uint32_t outputPeriodMax = 40000; // 40,000 usecs //Funtion Prototypes void ISR_Button(); void saveFreq(); //======================================= Setup ================================================== void setup() { pinMode(potPin, INPUT); pinMode(ledPin, OUTPUT); analogReadResolution(10); //10bit ADC //Initialise interrupt attachInterrupt(buttonPin, ISR_Button, FALLING); //Faling edge detection Serial.begin(115200); } //===================================== Main Loop ================================================ void loop() { static uint32_t previousTime_us = 0; //Static -> reads once //Change state to save frequency while(buttonState == 1){ saveFreq(); } //PWM plot point 1 //Serial.println(ledState); //Toggle LED state ledState = !ledState; digitalWrite(ledPin,ledState); //PWM plot point 2 //Serial.println(ledState); //Format input signal inputPot = analogRead(potPin)/10; //Divide by 10 for more stable values inputPot = constrain(inputPot,1,102); //Map input to output range outputPeriod = map(inputPot, inputMin, inputMax, outputPeriodMax, outputPeriodMin); //Calculate frequency freq = (1.0/outputPeriod) * 1000000.0; //Multiply by 10^6 to get Hz result as period is in usec //Print Results // Serial.print("Input val: "); // Serial.print(inputPot); // Serial.print(" Output val: "); // Serial.print(outputPeriod); // Serial.print(" Button: "); // Serial.print(buttonState); Serial.print(" Frequency: "); Serial.print(freq); Serial.println("Hz "); //Configure scan time scanTime = outputPeriod/2; while((micros()-previousTime_us) <= scanTime) { //do nothing } previousTime_us = micros(); } //======================================= ISR ================================================== //Interrupt service routine void ISR_Button(){ static uint32_t previousMillisButton = 0; uint32_t currentMillisButton = millis(); //Serial.println("Arrived in ISR"); if ((currentMillisButton - previousMillisButton) >= debounceTime_ms){ previousMillisButton = currentMillisButton; buttonState = !buttonState; } } //======================================= Save Frequency======================================== //End of program void saveFreq(){ Serial.print("Chosen freq: "); Serial.print(freq); Serial.print("Hz Period: "); Serial.print(outputPeriod); Serial.println("us. Press button to return"); }
a5868668e77fdc24f45c93c4e950de5131baa8ac
4a0182f33147034ee4ff2b6ed6b1b2563aa046ad
/r/r/pc/cpp/soc/src/tcp_test_socket_main.cpp
547709a03e577f0f4a8857be95a365e8778ad536
[]
no_license
thibugio/obor
0b9227124b317df3068c6ea473ebf9ce93fdece1
078c4f477d2cb9cd5a52caae86abb60d85bf6a13
refs/heads/master
2020-12-31T00:17:46.228156
2015-11-01T20:29:22
2015-11-01T20:29:22
45,356,114
0
0
null
null
null
null
UTF-8
C++
false
false
3,377
cpp
tcp_test_socket_main.cpp
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <boost/asio.hpp> #define PORT_NO 12345 using namespace std; using namespace boost::asio; std::vector<struct udp_packet> buf; //enum field { ""...} struct udp_packet { char * field; unsigned int data; }; void assertfail(bool cond, const char * msg) { if (!cond) { printf("%s\n", msg); exit(EXIT_FAILURE); } } struct rcv_handler_struct { struct udp_packet p; void operator() (const boost::system::error_code& ec, std::size_t bytes_received) { if (!ec) { // do stuff printf("received %d bytes from remote client.\n", (int)bytes_received); p=buf[0]; } } }; unsigned short bind(ip::udp::socket& sock, ip::udp::endpoint endpoint) { boost::system::error_code ec; sock.open(endpoint.protocol(), ec); assertfail(!ec, ("Error opening socket: " + ec.message() + "\n").c_str()); printf("successfully opened socket.\n"); ec.clear(); unsigned short port = endpoint.port() - 1; do { sock.bind(ip::udp::endpoint(endpoint.protocol(), ++port), ec); } while (ec && port > 0); assertfail(!ec, ("Error binding socket to local endpoint: " + ec.message() + "\n").c_str()); printf("successfully bound socket to local endpoint at port %d.\n", (int)port); return port; } int main(int argc, char * argv[]) { boost::system::error_code ec; ip::udp::endpoint local_endpoint(ip::udp::v4(), PORT_NO); //ip::tcp::endpoint tcp_local_endpoint(ip::tcp::v4(), PORT_NO); //ip::tcp::endpoint tcp_remote_endpoint; io_service io; try { //create a tcp welcome socket and open it to listen on the local endpoint ip::tcp::acceptor acceptor(io, tcp_local_endpoint); //create a udp socket and bind it to the local endpoint ip::udp::socket sock(io, local_endpoint); //ip::udp::socket sock(io); //unsigned int port = bind(sock, local_endpoint); //set socket options boost::asio::socket_base::reuse_address option(true); sock.set_option(option, ec); assertfail(!ec, ("Error setting option reuse_address: " + ec.message() + "\n").c_str()); ec.clear(); socket_base::keep_alive option2(true); sock.set_option(option2, ec); assertfail(!ec, ("Error setting option keep_alive: " + ec.message() + "\n").c_str()); ec.clear(); acceptor.set_option(option2, ec); assertfail(!ec, ("Error setting option keep_alive: " + ec.message() + "\n").c_str()); ec.clear(); //accept connection to remote client acceptor.accept(sock, tcp_remote_endpoint, ec); assertfail(!ec, ("Error accepting connection: " + ec.message() + "\n").c_str()); ec.clear(); //start listening struct rcv_handler_struct rcvr; struct udp_packet p; buf.push_back(p); sock.async_receive(buffer(buf), rcvr); sock.get_io_service().run(); sock.close(ec); assertfail(!ec, ("Error closing socket: " + ec.message() + "\n").c_str()); printf("successfully closed socket. Exiting application.\n"); } catch (boost::system::system_error e) { assertfail(false, ("boost system_error: " + string(e.what()) + "\n").c_str()); } return 0; }
2fd8dfa78139cf00aed348f240e589584ece5b7e
ff0cc7e931d038a9bd9a56665b20cd8dab071959
/src/Modules/BaseLib/libmodules/blUtilities/include/blTag.h
92f80f815bbb4258485788630d2dc99766e89e68
[]
no_license
jakubsadura/Swiezy
6ebf1637057c4dbb8fda5bfd3f57ef7eec92279b
bd32b7815b5c0206582916b62935ff49008ee371
refs/heads/master
2016-09-11T00:39:59.005668
2011-05-22T19:38:33
2011-05-22T19:38:33
1,784,754
3
1
null
null
null
null
UTF-8
C++
false
false
2,270
h
blTag.h
/* * Copyright (c) 2009, * Computational Image and Simulation Technologies in Biomedicine (CISTIB), * Universitat Pompeu Fabra (UPF), Barcelona, Spain. All rights reserved. * See license.txt file for details. */ #ifndef _blTag_H #define _blTag_H #include "blLightObject.h" #include "CILabExceptionMacros.h" #include <boost/any.hpp> #include <string> /** \brief Id, name and value \note size_t cannot be used because it's different depending on the platform (32 or 64 bits) \author Xavi Planes \date 28 July 2009 \ingroup blUtilities */ class blTag : public blLightObject { public: typedef blTag Self; typedef blSmartPointer<Self> Pointer; blNewMacro2param(Self, const std::string, boost::any ); blNewMacro3param(Self, unsigned long, const std::string, boost::any ); cilabDeclareExceptionMacro(Exception, std::exception) public: //! Get the name std::string GetName() const; //! void SetName(std::string val); //! void SetValue(boost::any val); //! boost::any GetValue(); //! Templated GET method template <typename T> bool GetValue(T& value ) const { try { value = boost::any_cast<T>(m_Value); } catch(boost::bad_any_cast&) { return false; } return true; } //! Templated GET method template <typename T> T GetValueCasted( ) const { return boost::any_cast<T>( m_Value ); } //! automatically cast double, float, char, int,long and std::string types std::string GetValueAsString(); //! automatically cast double, float, char, int,long and std::string types void SetValueAsString( const std::string &typeName, std::string value ); //! unsigned long GetId() const; void SetId(unsigned long val); //! Compare the value of the two tags bool Compare( blTag::Pointer ); /** Return the name of a type Using typeid( std::string ).name( ) is not cross platform */ static std::string GetTypeName( const std::type_info& info ); //! std::string GetTypeName( ); protected: //! blTag( unsigned long id = 0, const std::string &name = "", boost::any value = NULL ); //! blTag( const std::string &name, boost::any value = NULL ); //! virtual ~blTag(); private: //! unsigned long m_Id; //! std::string m_Name; //! boost::any m_Value; }; #endif // _coreDataEntityTag_H
8b76ed467f0480e64ef1744d47ba5ec0ce13b70f
37aa4ed36801649807f061dd1f54c543908bfb0d
/Sem/Przykłady/composite_node/main.cpp
cee3417afd71e2859006ca69d14e637138b872c9
[]
no_license
cocoyenn/IntelTBB_project
6178689267761378e20cbff79adbef047ebbe3ef
3d3002ad1beaad8282e5a87a246d3b055658f096
refs/heads/master
2020-04-27T17:27:53.505648
2019-09-16T20:14:50
2019-09-16T20:14:50
174,520,701
0
0
null
null
null
null
UTF-8
C++
false
false
2,030
cpp
main.cpp
#include "tbb/flow_graph.h" #include <iostream> #include <tuple> using namespace tbb::flow; //template< typename InputTuple, typename OutputTuple > class composite_node; class smart_odd_square : public composite_node<tuple<int, int>, tuple<int>> { join_node<tuple<int, int>, queueing> j; function_node<tuple<int, int>, int> f; typedef composite_node<tuple<int, int>, tuple<int>> base_type; struct f_body { int operator()(const tuple<int, int> &t) { int n = (get<1>(t) + 1) / 2; int sum = get<0>(t) + get<1>(t); std::cout << "Suma " << n << " pozytywnych liczb nieparzystych to 2 ^ " << n << " i wynosi: " << sum << std::endl; return sum; } }; public: smart_odd_square(graph &g) : base_type(g), j(g), f(g, unlimited, f_body()) { make_edge(j, f); //tuple<int, int> = composite_node< tuple<int,int>, tuple<int> >::input_ports_type base_type::input_ports_type input_tuple(input_port<0>(j), input_port<1>(j)); //tuple<int> = composite_node< tuple<int,int>, tuple<int> >::output_ports_type base_type::output_ports_type output_tuple(f); base_type::set_external_ports(input_tuple, output_tuple); } }; int main() { graph g; split_node<tuple<int, int, int, int, int>> s(g); smart_odd_square a0(g); smart_odd_square a1(g); smart_odd_square a2(g); smart_odd_square a3(g); make_edge(output_port<0>(s), input_port<0>(a0)); make_edge(output_port<1>(s), input_port<1>(a0)); make_edge(output_port<0>(a0), input_port<0>(a1)); make_edge(output_port<2>(s), input_port<1>(a1)); make_edge(output_port<0>(a1), input_port<0>(a2)); make_edge(output_port<3>(s), input_port<1>(a2)); make_edge(output_port<0>(a2), input_port<0>(a3)); make_edge(output_port<4>(s), input_port<1>(a3)); s.try_put(std::make_tuple(1, 3, 5, 7, 9)); g.wait_for_all(); return 0; }
8129467397fe5487ea28896eb86fbc4885c1237f
19eec37edff87e0b3f234d5772e5555f5c83b17e
/src/essence.game/packets/lobby/incoming/Login.h
a0fe89f1330ab43df73d704f9a08e7cf9243a5bd
[ "MIT" ]
permissive
jellenijhof12/qpang-essence-emulator
4632927d3b605a7e17e80539ec76288525c6b324
943189161fd1fb8022221f24524a18244724edd6
refs/heads/master
2023-07-02T20:46:42.313580
2021-08-12T14:18:37
2021-08-12T14:18:37
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,673
h
Login.h
#pragma once #include <boost/uuid/uuid_generators.hpp> #include <boost/uuid/uuid_io.hpp> #include "core/Emulator.h" #include "core/database/Database.h" #include "core/communication/packet/PacketEvent.h" #include "qpang/Game.h" #include "packets/lobby/outgoing/account/VerificationFailure.h" #include "packets/lobby/outgoing/account/Banned.h" #include "packets/lobby/outgoing/account/Authenticated.h" class Login : public PacketEvent { public: bool isUnauthorizedPacket() override { return true; } void handle(QpangConnection::Ptr conn, QpangPacket& packet) { std::array<uint8_t, 16> uuidArr = packet.read<std::array<uint8_t, 16>>(); boost::uuids::uuid uuid; std::memcpy(uuid.data, &uuidArr, boost::uuids::uuid::static_size()); std::string uuidStr = boost::uuids::to_string(uuid); uint32_t userId = 0; { Statement::Ptr stmt = DATABASE->prepare("SELECT id FROM users WHERE session_uuid = ?"); stmt->bindString(uuidStr.c_str()); StatementResult::Ptr res = stmt->fetch(); if (!res->hasResults()) // invalid uuid { conn->send(VerificationFailure()); return conn->close(); } userId = res->getInt("id"); } bool isBanned = Game::instance()->getBanManager()->isBanned(userId); if (isBanned) { conn->send(Banned()); return conn->close(); } uint32_t playerId = 0; { auto stmt = DATABASE->prepare("SELECT id FROM players WHERE user_id = ?"); stmt->bindInteger(userId); auto res = stmt->fetch(); if (!res->hasResults()) return conn->close(); playerId = res->getInt("id"); } Game::instance()->createPlayer(conn, playerId); conn->send(Authenticated(conn->getPlayer())); } };
4c046888a9a384ffb91cb18f3ef6ddd231c67b6e
9508cec594de0ce96bde3cc20157c156d107f6c3
/AtcoderARC/arc108/b.cpp
ed5916f5fdd51347436b56248e67ca25b39fb311
[]
no_license
kouki8710/Programming-competitions
62a35c4d9a8636c64b1d1d8e47fbc5d8db1a85e4
518debc531e9c5b0ea6e2437690ad13be32725b9
refs/heads/master
2023-03-12T13:54:31.994219
2021-02-27T06:10:53
2021-02-27T06:10:53
324,536,436
0
0
null
null
null
null
UTF-8
C++
false
false
769
cpp
b.cpp
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define INF 100000000 #define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++) #define repp(i, n, s) for (int i = (int)(n); i >= (int)(s); i--) #define mp make_pair ll mod = 1000000007; ll mod2 = 998244353; int main() { cin.tie(0); ios::sync_with_stdio(false); int n;cin>>n; string s;cin>>s; string a = ""; rep(i,0,n){ a += s[i]; int size = a.size(); if (size>=3){ string fox = ""; repp(j,size-1,size-3){ fox += a[j]; } if (fox=="xof"){ a = a.erase(a.size()-3); } } } cout<<a.size()<<endl; }
d7003ed679b66b644b9c093898f463d1b93dcc72
7eb21b2a47971e20ee5a5f29234d68819298f123
/src/util/CLog.cpp
53b53c4fef1483637df5e2ffa50f6d4eebfbdfcd
[]
no_license
utcman1/ndbAsynch
0da15bb7bfd34b7ff69dd90817962aa520c6fc99
bba323c378e5c827f06291c0634922f9088afd8e
refs/heads/master
2021-01-10T02:04:30.042211
2016-02-24T15:41:33
2016-02-24T15:41:33
45,304,131
0
0
null
null
null
null
UTF-8
C++
false
false
1,138
cpp
CLog.cpp
#include <stdafx.hpp> #include <util/CLog.hpp> NullOutputStream __NullOutputStream; NdbOut nullout(__NullOutputStream); NdbOut& __LogNdbDebug = #ifdef _DEBUG ndbout; #else nullout; #endif NdbOut& __LogNdbWarning = ndbout; NdbOut& __LogNdbError = ndberr; NdbOut& __LogNdbCritical = ndberr; NdbOut& __LogUserDebug = #ifdef _DEBUG ndbout; #else nullout; #endif NdbOut& __LogUserWarning = ndbout; NdbOut& __LogUserError = ndberr; NdbOut& __LogUserCritical = ndberr; NdbOut& operator<<(NdbOut& _NdbOut, const std::chrono::time_point < std::chrono::system_clock, std::chrono::system_clock::duration >& _Now) { std::time_t t = std::chrono::system_clock::to_time_t(_Now); char StrBuf[32]; // '2000-01-01 00:00:00.' : 20자리 필요 std::tm tm; localtime_r(&t, &tm); strftime(StrBuf, sizeof(StrBuf), "%Y-%m-%d %H:%M:%S.", &tm); _NdbOut << StrBuf; // milli second 출력 long long llMillisec = std::chrono::duration_cast<std::chrono::milliseconds>(_Now.time_since_epoch()).count() % 1000; int millisec = static_cast<int>(llMillisec); sprintf(StrBuf, "%03d", millisec); _NdbOut << StrBuf; return _NdbOut; }
ba3207360ce6e6098d66260a8fe00925ff37df6e
d6b4bdf418ae6ab89b721a79f198de812311c783
/cvm/include/tencentcloud/cvm/v20170312/model/GPUInfo.h
fd1919a9fe8baf93007f713d7b81715de48d17f9
[ "Apache-2.0" ]
permissive
TencentCloud/tencentcloud-sdk-cpp-intl-en
d0781d461e84eb81775c2145bacae13084561c15
d403a6b1cf3456322bbdfb462b63e77b1e71f3dc
refs/heads/master
2023-08-21T12:29:54.125071
2023-08-21T01:12:39
2023-08-21T01:12:39
277,769,407
2
0
null
null
null
null
UTF-8
C++
false
false
5,651
h
GPUInfo.h
/* * Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef TENCENTCLOUD_CVM_V20170312_MODEL_GPUINFO_H_ #define TENCENTCLOUD_CVM_V20170312_MODEL_GPUINFO_H_ #include <string> #include <vector> #include <map> #include <tencentcloud/core/utils/rapidjson/document.h> #include <tencentcloud/core/utils/rapidjson/writer.h> #include <tencentcloud/core/utils/rapidjson/stringbuffer.h> #include <tencentcloud/core/AbstractModel.h> namespace TencentCloud { namespace Cvm { namespace V20170312 { namespace Model { /** * GPU information of the instance */ class GPUInfo : public AbstractModel { public: GPUInfo(); ~GPUInfo() = default; void ToJsonObject(rapidjson::Value &value, rapidjson::Document::AllocatorType& allocator) const; CoreInternalOutcome Deserialize(const rapidjson::Value &value); /** * 获取Number of GPUs. Note: this field may return `null`, indicating that no valid value can be found. * @return GPUCount Number of GPUs. Note: this field may return `null`, indicating that no valid value can be found. * */ double GetGPUCount() const; /** * 设置Number of GPUs. Note: this field may return `null`, indicating that no valid value can be found. * @param _gPUCount Number of GPUs. Note: this field may return `null`, indicating that no valid value can be found. * */ void SetGPUCount(const double& _gPUCount); /** * 判断参数 GPUCount 是否已赋值 * @return GPUCount 是否已赋值 * */ bool GPUCountHasBeenSet() const; /** * 获取GPU address Note: this field may return `null`, indicating that no valid value can be found. * @return GPUId GPU address Note: this field may return `null`, indicating that no valid value can be found. * */ std::vector<std::string> GetGPUId() const; /** * 设置GPU address Note: this field may return `null`, indicating that no valid value can be found. * @param _gPUId GPU address Note: this field may return `null`, indicating that no valid value can be found. * */ void SetGPUId(const std::vector<std::string>& _gPUId); /** * 判断参数 GPUId 是否已赋值 * @return GPUId 是否已赋值 * */ bool GPUIdHasBeenSet() const; /** * 获取GPU type of the instance. Note: this field may return `null`, indicating that no valid value can be found. * @return GPUType GPU type of the instance. Note: this field may return `null`, indicating that no valid value can be found. * */ std::string GetGPUType() const; /** * 设置GPU type of the instance. Note: this field may return `null`, indicating that no valid value can be found. * @param _gPUType GPU type of the instance. Note: this field may return `null`, indicating that no valid value can be found. * */ void SetGPUType(const std::string& _gPUType); /** * 判断参数 GPUType 是否已赋值 * @return GPUType 是否已赋值 * */ bool GPUTypeHasBeenSet() const; private: /** * Number of GPUs. Note: this field may return `null`, indicating that no valid value can be found. */ double m_gPUCount; bool m_gPUCountHasBeenSet; /** * GPU address Note: this field may return `null`, indicating that no valid value can be found. */ std::vector<std::string> m_gPUId; bool m_gPUIdHasBeenSet; /** * GPU type of the instance. Note: this field may return `null`, indicating that no valid value can be found. */ std::string m_gPUType; bool m_gPUTypeHasBeenSet; }; } } } } #endif // !TENCENTCLOUD_CVM_V20170312_MODEL_GPUINFO_H_
17f81dd32de317152ddab7f9c8eaaa20ddd93a1e
baf3387ce913a33ea70722a21fc63992eb355372
/HTracker/FeatureTracker.h
dd176f8e8dd1f1ef2da3ed8dc457784c09683477
[]
no_license
xzvfinet/HTracker
2674602b8a51ee6f12e1e275d8e998c05a26e9d9
f4a2ee84097a2c4f3815ca429216bb981b24d206
refs/heads/master
2021-01-18T18:14:00.154935
2015-05-28T11:18:06
2015-05-28T11:18:06
36,100,594
1
0
null
null
null
null
UTF-8
C++
false
false
743
h
FeatureTracker.h
#pragma once #include "stdafx.h" #include "BriskMatcher.h" #include "KalmanTest.h" #include "Features.h" #include "Matcher.h" class FeatureTracker { public: FeatureTracker(void); ~FeatureTracker(void); void compute(int feature, Mat img, Rect r); void computeBrisk(Mat img, Rect r); Rect getRect(); // get person1's rect double getHeight(); // get person1's height void setMatch(bool val); bool match(Mat img, Rect r); void forceMatch(Mat img, Rect r); void kalmanInit(Rect r); void kalmanPredict(); void kalmanCorrect(); void kalmanDraw(Mat img); bool isEmpty(); BriskMatcher brisk; KalmanTest kalman; KalmanTest kalman_map; bool isPrepared; bool isMatch; int countNoMatch; int countMissing; int r,g,b; };
162dc3ad01f8ca890dab529c5b02df9f4b263378
98d25456e1ed88e32a940ea26e1051c9ef9f640e
/lang/steve/Overload.hpp
03f63777eb34eb661449d1f19397030b0ae382d1
[ "Apache-2.0" ]
permissive
flowgrammable/steve-legacy
3184cc710f5c6ad153d36230d3d4ff02a13ec42d
5e7cbc16280c199732d26a2cb0703422695abe16
refs/heads/master
2021-01-12T21:00:22.958379
2015-03-29T23:02:42
2015-03-29T23:02:42
19,458,176
1
0
null
null
null
null
UTF-8
C++
false
false
2,073
hpp
Overload.hpp
#ifndef OVERLOAD_HPP #define OVERLOAD_HPP #include <steve/Conv.hpp> #include <steve/Error.hpp> #include <steve/Debug.hpp> #include <vector> // This module provides facilities used in the declaration of and // resolution of overloaded functions. namespace steve { struct Decl; struct Overload; // An overload candidate is a function declaration and a sequence of // arguments that can be used to call that function. struct Candidate { Candidate(Def*, Term*, Expr_seq*); explicit operator bool() const; Def* def; // The candidate definition Term* fn; // The candidate function Expr_seq* args; // The call arguments (possibly converted) Conversion_list convs; // Conversions required to call the function Diagnostics diags; // Diagnostics resulting from the check bool viable; // True if viable. }; // A candidate list is a list of declarations that can be // targets of a function call. using Candidate_list = std::vector<Candidate>; // A resolution class contains the result of overload resolution. // // TODO: This should probably also store the initial list of // candidates since we would probably want to diagnose the struct Resolution { enum Result { empty_res, unique_res, ambig_res } result; union Data { Data() : single(nullptr) { } Data(Decl* d) : single(d) { } Data(Candidate_list&& v) : multiple(std::move(v)) {} ~Data() { } Decl* single; Candidate_list multiple; } data; Resolution(); Resolution(Resolution&&); Resolution(Decl*); Resolution(Candidate_list&&); ~Resolution(); bool is_empty() const; bool is_unique() const; bool is_ambiguous() const; Decl* solution() const; const Candidate_list& solutions() const; }; bool declare_overload(Overload&, Decl*); Resolution resolve_call(Location, Overload&, Expr_seq*); Resolution resolve_unary(Location, Overload&, Expr*); Resolution resolve_binary(Location, Overload&, Expr*, Expr*); } // namespace steve #include <steve/Overload.ipp> #endif
a1038f9b788aeeae86e252dfcee9098954efd2e3
02242585871ebf9129684541246d0688a447f03e
/UI/BorrowInfoWidget.cpp
30f312864c36a1a737956ace61f132d6506fafe8
[]
no_license
zy98/LibraryManagement
6d0ab525b80703913d5ba3f25cd3ddb59e3f0709
ffb27bf346ea95568f584a6493a1ec8e532fa8a1
refs/heads/master
2020-04-10T09:20:25.278992
2018-12-20T06:36:31
2018-12-20T06:36:31
160,933,503
0
0
null
null
null
null
UTF-8
C++
false
false
3,719
cpp
BorrowInfoWidget.cpp
#include "BorrowInfoWidget.h" #include "ui_BorrowInfoWidget.h" #include "Model/BorrowInfoModel.h" #include <QSqlRelationalTableModel> #include <QDebug> #include <QButtonGroup> #include <QSqlQuery> BorrowInfoWidget::BorrowInfoWidget(QWidget *parent) : Widget(parent), ui(new Ui::BorrowInfoWidget) { ui->setupUi(this); QSqlDatabase db = QSqlDatabase::database("Library"); model = new BorrowInfoModel(ui->tableView,db); QButtonGroup* btn_group = new QButtonGroup(this); btn_group->addButton(ui->chk_all,0); btn_group->addButton(ui->chk_noreturn,1); btn_group->addButton(ui->chk_relend,2); btn_group->addButton(ui->chk_over,3); initModel(); initView(); connect(btn_group,SIGNAL(buttonClicked(int)),this,SLOT(BtnFilter(int))); } BorrowInfoWidget::~BorrowInfoWidget() { delete ui; } //for BorrowAdmin Reader void BorrowInfoWidget::setStatusFor(WidgetStatus status) { if(status == BorrowAdmin) { ui->groupBorrow->show(); } else { ui->groupBox->hide(); ui->groupBorrow->hide(); } } void BorrowInfoWidget::initView() { ui->tableView->setModel(model); ui->tableView->setSelectionBehavior(QTableView::SelectRows); ui->tableView->setSelectionMode(QTableView::SingleSelection); ui->tableView->setEditTriggers(QTableView::NoEditTriggers); ui->tableView->setColumnHidden(3,true); ui->tableView->setColumnHidden(4,true); } void BorrowInfoWidget::initModel() { } void BorrowInfoWidget::BtnFilter(int id) { if(id == 1) { model->setFilter("returnDate is NULL"); model->select(); } else if(id == 2) { //实际应该与读者类型表比较 model->setFilter("lendTimes = 0 and returnDate is NULL"); model->select(); } else if(id == 3) { model->setFilter("outDays != 0"); model->select(); } else { model->setFilter(""); } model->select(); } void BorrowInfoWidget::setReader(const QString& rd) { QMap<QString, QVariant> map; map["rdID"] = rd; if(!model->selectItem(map,false)) showError(model->dbError()); } QTableView* BorrowInfoWidget::viewPtr() { return ui->tableView; } AbModel* BorrowInfoWidget::modelPtr() { return model; } void BorrowInfoWidget::on_btn_returnBook_clicked() { emit returnBook(ui->tableView->selectionModel()); } void BorrowInfoWidget::on_btn_search_clicked() { QMap<QString,QVariant> map; auto text = ui->edit_rdid->text(); if(text != "") map["rdID = "] = text; text = ui->edit_bkid->text(); if(text != "") map["bkID = "] = text; if(ui->chk_noreturn->isChecked()) map["returnDate "]="is NULL "; if(ui->chk_over->isChecked()) map["outDays "] = " > 0 "; if(ui->chk_relend->isChecked()) map["lendTimes = "] = " 0"; auto i = map.begin(); QString filter = i.key()+i.value().toString(); for(++i; i != map.end(); ++i) filter += QString(" and %1 %2 ").arg(i.key()).arg(i.value().toString()); qDebug()<<filter; model->setFilter(filter); if(!model->select()) showError(model->dbError()); } void BorrowInfoWidget::on_btn_reLend_clicked() { auto list = ui->tableView->selectionModel()->selectedIndexes(); if(!list.isEmpty()) { QSqlDatabase db = QSqlDatabase::database("Library"); QSqlQuery query(db); query.prepare("exec usp_relend ?, ?"); query.addBindValue(list[0].data().toLongLong()); query.addBindValue(list[2].data().toString()); if(!query.exec()) showError(query.lastError().text()); else model->select(); } }
c407f907e660865136e78e7caf1adc5c4dbe429f
389d83fd02cd4ed07c20cd16ef0976dd0f37f83d
/contest06/bai02.cpp
69daba138f38872bafcda3b816b7030ecda69873
[]
no_license
minchau2111/Code
1c2240ed6adca009474d4fbf024f06c33b10759a
45d21acf0af5e1067ac06350ebc3c86db422fdcb
refs/heads/master
2022-11-08T13:18:49.825456
2020-06-25T02:34:10
2020-06-25T02:34:10
269,273,534
0
0
null
null
null
null
UTF-8
C++
false
false
445
cpp
bai02.cpp
// sắp xếp theo |X-a[i]| #include<bits/stdc++.h> using namespace std; int x,n; bool sapxep(int m, int n){ return fabs(m-x)<fabs(n-x); } int main(){ int t; cin>>t; while(t--){ cin>>n; cin>>x; int a[n+5]; for(int i=0;i<n;i++){ cin>>a[i]; } stable_sort(a,a+n,sapxep); for(int i=0;i<n;i++){ cout<<a[i]<<" "; } cout<<endl; } }
353ddc0861504038fe27a0abfa35ddcdc6d284e7
c4673ff3c95282ba0a84684a0501c43ab1b4bc8c
/cs214/task7.cpp
093207303f3f53fb2474d8599e69d8de5911ada3
[]
no_license
MuhammadFaleh/cs214-assignments
5eb598c6c477ad6d89a63f434aa05848039615bb
24f9ae8c8fdbf410e58abff1cd46baa2cf764d7d
refs/heads/main
2023-07-16T17:12:47.297237
2021-09-02T21:05:29
2021-09-02T21:05:29
402,560,291
0
0
null
null
null
null
UTF-8
C++
false
false
2,642
cpp
task7.cpp
#include <iostream> #include <string> using namespace std; class TicTacToe{ char orderOP , save , in ,in2; string nameOP1 ,nameOP2 ; char borad [3][3] {{'1' , '2' , '3' },{ '4' , '5' ,'6'} ,{'7' ,'8' ,'9'}}; public: void orderAndN(){ cout<<"player one enter your name\n"; getline(cin,nameOP1); cout<<"choose X or O\n"; cin>>orderOP; cout<<"player two enter your name\n"; getline(cin,nameOP2); if (orderOP == 'X' || orderOP == 'x'){ save ='O'; orderOP ='X'; cout<<"player two you will be playing "<<save;} else if (orderOP == 'O' || orderOP == 'o'){ save ='X'; orderOP ='O';} } char userinput(){ while(1){ cin>>in; if(in != in2){ if (in == '1') borad[0][0] = orderOP; else if (in =='2') borad[0][1] = orderOP; else if (in =='3') borad[0][2] = orderOP; else if (in =='4') borad[1][0] = orderOP; else if (in =='5') borad[1][1] = orderOP; else if (in =='6') borad[1][2] = orderOP; else if (in =='7') borad[2][0] = orderOP; else if (in =='8') borad[2][1] = orderOP; else if (in =='9') borad[2][2] = orderOP; break ;} else if (in ==in2) {cout<<"choose a new place"; continue;}}} char useinput1(){ while (1){ cin>>in; if(in2 != in){ if (in == '1') borad[0][0] = save; else if (in =='2') borad[0][1] = save; else if (in =='3') borad[0][2] = save; else if (in =='4') borad[1][0] = save; else if (in =='5') borad[1][1] = save; else if (in =='6') borad[1][2] = save; else if (in =='7') borad[2][0] = save; else if (in =='8') borad[2][1] = save; else if (in =='9') borad[2][2] = save; break;}else if (in ==in2) {cout<<"choose a new place"; continue;}}} void DuringROUND(){ cout<<"player one you may choose any of place\n"; for(int x = 0; x<3; x++){ for (int y = 0; y<3; y++ ){ cout<<borad[x][y]<<" "; } cout<<"\n"; } userinput(); for(int x = 0; x<3; x++){ for (int y = 0; y<3; y++ ){ cout<<borad[x][y]<<" "; } cout<<"\n"; } cout<<"player two you may choose any of place that is not taken\n"; useinput1(); for(int x = 0; x<3; x++){ for (int y = 0; y<3; y++ ){ cout<<borad[x][y]<<" "; } cout<<"\n"; }} }; int main(){ TicTacToe T1; char choise; while (choise !='-1') cout<<"1.single player(player vs pc)\n2.two player(player vs player)"; cin>>choise; if(choise =='2'){ T1.orderAndN(); T1.DuringROUND(); } if (choise =='1'){ } }
cc3e4bf7ee9d4558c145fe9514b24a7318dff9fb
ebe1eaf68b4ebe941e564ecaf536a06d625e1eda
/Engine/src/ThirdParty/NIF/src/gen/TexDesc.cpp
39a1921e31cbe2323f011760fa92e823518618ef
[]
no_license
przemyslaw-szymanski/x-source-engine
54a23e9ad740f7ab1b4a439f87733c366233eb58
1afa8c0dea628b6a252ee40aef39c31ec99d3c97
refs/heads/master
2020-12-24T15:41:01.851654
2015-08-07T14:37:12
2015-08-07T14:37:12
13,867,990
0
0
null
null
null
null
UTF-8
C++
false
false
1,338
cpp
TexDesc.cpp
/* Copyright (c) 2006, NIF File Format Library and Tools All rights reserved. Please see niflib.h for license. */ //---THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT---// //To change this file, alter the niftools/docsys/gen_niflib.py Python script. #include "../../include/gen/TexDesc.h" #include "../../include/obj/NiSourceTexture.h" using namespace Niflib; //Constructor TexDesc::TexDesc() : source(NULL), clampMode((TexClampMode)WRAP_S_WRAP_T), filterMode((TexFilterMode)FILTER_TRILERP), uvSet((unsigned int)0), ps2L((unsigned short)0), ps2K((unsigned short)0xFFB5), unknown1((unsigned short)0), hasTextureTransform(false), wRotation(0.0f), transformType_((unsigned int)0) {}; //Copy Constructor TexDesc::TexDesc( const TexDesc & src ) { *this = src; }; //Copy Operator TexDesc & TexDesc::operator=( const TexDesc & src ) { this->source = src.source; this->clampMode = src.clampMode; this->filterMode = src.filterMode; this->uvSet = src.uvSet; this->ps2L = src.ps2L; this->ps2K = src.ps2K; this->unknown1 = src.unknown1; this->hasTextureTransform = src.hasTextureTransform; this->translation = src.translation; this->tiling = src.tiling; this->wRotation = src.wRotation; this->transformType_ = src.transformType_; this->centerOffset = src.centerOffset; return *this; }; //Destructor TexDesc::~TexDesc() {};
e1f89573fdd950d48bd0ea51e7c37660cd2351ed
8d63305eb345f183f4a600c21afbc3a1504d863d
/剑指offer/58-左旋转字符串-P286/c++/solution.cpp
e527984c45edd746fd0f8a33e769b2709632fcc4
[]
no_license
yesxiaoyu/Coding
ace972f1f51caab46783f0150c741d8a8844cc2e
898b4157013bcd1b8d499276044e2aff1aaa7e45
refs/heads/master
2020-09-10T20:35:15.435385
2020-06-05T02:51:28
2020-06-05T02:51:28
221,827,822
0
0
null
null
null
null
UTF-8
C++
false
false
1,174
cpp
solution.cpp
// Author : lihongyu // Time : 2019-12-13 #include<bits/stdc++.h> using namespace std; // 剑指offer58-左旋转字符串-P286 // 思路:调用58-翻转字符串-P284中reverse函数3次 // 时间复杂度: O(n) // 空间复杂度: O(1) class Solution { public: string LeftRotateString(string str, int n) { if (str.length() < 2) return str; int firstStart = 0, firstEnd = n - 1, secondStart = n, secondEnd = str.length()-1; ReverseWord(str, firstStart, firstEnd); ReverseWord(str, secondStart, secondEnd); ReverseWord(str, firstStart, secondEnd); return str; } private: void ReverseWord(string &str, int s, int e) { while(s < e) swap(str[s++], str[e--]); } }; class Solution2 { public: string LeftRotateString(string str, int n) { reverse(str.begin(), str.end()); reverse(str.begin(), str.begin() + str.size() - n); reverse(str.begin() + str.size() - n, str.end()); return str; } }; // TODO: int main(){ string str = ","; // "abcdefg"; int num = 6; // 2 cout<<Solution().LeftRotateString(str, num)<<endl; return 0; }
b5677790c31a7afb93f3f8b3ece080442d869f16
aa94661adba64921817cbc6640f9b57f2db38e1e
/include/private/proofcore/coreapplication_p.h
9aa68b2bad745afe72b23a35d594648434f3446e
[ "BSD-3-Clause" ]
permissive
opensoft/proofbase
11b7a4ec7d44b73860ac81c588ed88e775c657ac
2e633df6f8dc005c13e4007ef4a75c93e63868d9
refs/heads/develop
2020-03-26T15:29:09.127993
2019-10-28T09:05:30
2019-10-28T09:05:29
145,046,425
10
6
BSD-3-Clause
2019-10-28T09:05:31
2018-08-16T22:49:28
C++
UTF-8
C++
false
false
2,729
h
coreapplication_p.h
/* Copyright 2018, OpenSoft Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are permitted * provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or other materials provided * with the distribution. * * Neither the name of OpenSoft Inc. nor the names of its contributors may be used to endorse * or promote products derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #ifndef COREAPPLICATION_P_H #define COREAPPLICATION_P_H #include "proofcore/proofcore_global.h" #include "proofcore/proofobject_p.h" #include <QDateTime> #include <QSet> #include <QTranslator> #include <QtCrypto> #include <QtGlobal> namespace Proof { class Settings; class CoreApplication; class PROOF_CORE_EXPORT CoreApplicationPrivate : public ProofObjectPrivate { Q_DECLARE_PUBLIC(CoreApplication) protected: virtual void postInit(); void initCrashHandler(); void updatePrettifiedName(); bool daemonizeIfNeeded(); void initLogs(bool daemonized); void execMigrations(); void initQca(); void initTranslator(); void setLanguage(const QString &currentLanguage); QString prettifiedApplicationName; QDateTime startedAt = QDateTime::currentDateTimeUtc(); Settings *settings = nullptr; QSet<QString> translationPrefixes; QStringList availableLanguages; QVariantMap fullLanguageNames; QString currentLanguage = QStringLiteral("en"); QVector<QTranslator *> installedTranslators; bool initialized = false; QScopedPointer<QCA::Initializer> qcaInit; }; } // namespace Proof #endif // COREAPPLICATION_P_H
386b5ab4916e4ce72139bf525a4cab0cac1a6875
3de7d4c3a2a7480cbc6954b9239a0d2a81cdd1ae
/src/user.cpp
fb9dcba922cb11f2de86516d445e1f3c8daa379b
[]
no_license
jw-0/CSIT314-Project
dfec4b4f875dda4b4fde620570be6cca890f205a
a54e816fde0d3195053e4d0ea4a482cd1482ab13
refs/heads/master
2021-01-02T00:57:44.857453
2017-11-13T00:42:14
2017-11-13T00:42:14
98,947,205
0
0
null
null
null
null
UTF-8
C++
false
false
3,056
cpp
user.cpp
// Written by Jarod Wright #include "user.hpp" #include <fstream> #include <cgicc/HTMLClasses.h> #include "util.hpp" #include "debug.hpp" static std::string headerStr = "<table border=0 width=\"100%\"><tr><th colspan=3 style=\"border-bottom: 1px solid;\"/></tr>\n"; static std::string bottomStr = "<tr><th colspan=3 style=\"border-bottom: 1px solid;\"/></tr></table>"; static std::string backButton = "<button onclick=window.history.back()> Go Back </button>"; User::User() { id = 0; rating = 0.0; } void User::createUser(cgicc::Cgicc formdata) { username = getValue("username", formdata); firstName = getValue("firstName", formdata); lastName = getValue("lastName", formdata); email = getValue("email", formdata); phone = getValue("phone", formdata); password = getValue("password", formdata); ID += 1; id = ID; rating = 5.0; } void User::saveUser(const char *fileName) { std::ofstream out; out.open(fileName, std::ofstream::app); if(out.is_open()) { out << *this; #ifdef DEBUG std::cout << "<script> alert(\" Successfully wrote user! \"); </script>" << std::endl; #endif } else std::cout << "<script> alert(\"Cannot open " << fileName << "!\")</script>" << std::endl; out.close(); } bool operator==(const User &lhs, const User &rhs) { if(lhs.id == rhs.id && lhs.username == rhs.username && lhs.firstName == rhs.firstName && lhs.lastName == rhs.lastName && lhs.email == rhs.email && lhs.phone == rhs.phone && lhs.password == rhs.password) return true; return false; } std::istream &operator>>(std::istream &in, User &user) { in >> user.id >> user.username >> user.firstName >> user.lastName >> user.email >> user.phone >> user.password >> user.rating; return in; } std::ostream &operator<<(std::ostream &out, const User &user) { out << user.id << "\t" << user.username << "\t" << user.firstName << "\t" << user.lastName << "\t" << user.email << "\t" << user.phone << "\t" << user.password << "\t"<< user.rating << std::endl;; return out; } void loadUsers(std::vector<User> &users, const char *fileName) { std::ifstream in; User user; in.open(fileName); if(in.is_open()) { for(int i = 0; !in.eof(); i++) { in >> user; users.push_back(user); ID = user.getID(); } #ifdef DEBUG std::cout << "<script> alert(\"Successfully loaded users.dat!\"); </script>" << std::endl; #endif // sometimes we get duplicates, remove them if(users[users.size()-1] == users[users.size()-2]) users.pop_back(); } else std::cout << "<script> alert(\"Cannot open " << fileName << "!. Cannot load users into system.\")</script>" << std::endl; in.close(); if(in.is_open()) { std::cout << "<script> alert(\"" << fileName << " did not close properly. Trying again...\")</script>" << std::endl; in.close(); } }
523f6c68f263eace1e8578a49e47945dfc5eee76
5c08f4cfcd681af7ebbbabbfab150797f37465c5
/stresstestmode.h
62665b3f72f0f0654f07ce57873f90145561b7ee
[]
no_license
AveryFerrante/FinalProject
42014eff7a739bfa771ff5adb4d63b0cc3b7e619
52aa8ffcd18b2bd3af1e5415b203de738af68b01
refs/heads/master
2016-09-15T22:39:12.429421
2014-12-08T06:28:40
2014-12-08T06:28:40
null
0
0
null
null
null
null
UTF-8
C++
false
false
911
h
stresstestmode.h
#ifndef STRESSTESTMODE_H #define STRESSTESTMODE_H #include "IndexInterface.h" #include "hashtable.h" #include "parser.h" #include "documentindex.h" #include <windows.h> #include "interactivemode.h" // This has the most functionality, can't / don't want to copy all of the code into here #include <chrono> #include <ctime> //Inherits from interactive mode to inherit its functionality class StressTestMode : public InteractiveMode { private: Parser *parse; //Should make inputFile a member variable // UTILITY FUNCTIONS void loadCommand(std::ifstream &inputFile); void parseCommand(std::ifstream &inputFile); void queryCommand(std::ifstream &inputFile); void addCommand(std::ifstream &inputFile); void delCommand(); void setToNull(); void deleteObjects(); public: StressTestMode(int consoleArgs, char **consolePaths); void run(); }; #endif // STRESSTESTMODE_H
90ff3318cfd55903249ba958aa84eeba1569c0d7
1468b015f5ce882dbd39dc75c9a6560179a936fb
/card/M1321.h
b67817685f8305a125113243668ca092b724cd6d
[]
no_license
Escobaj/HearthstoneResolver
cbfc682993435c01f8b75d4409c99fb4870b9bb3
c93b693ef318fc9f43d35e81931371f626147083
refs/heads/master
2021-04-30T22:31:01.247134
2017-01-31T00:05:32
2017-01-31T00:05:32
74,474,216
8
0
null
null
null
null
UTF-8
C++
false
false
244
h
M1321.h
#ifndef HEARTHSTONERESOLVER_M1321_H #define HEARTHSTONERESOLVER_M1321_H #include "../Core/Entities/Minion.h" class M1321 : public Minion { public: M1321(const EventHandler &e); void init(); }; #endif //HEARTHSTONERESOLVER_M1321_H
48582822a0dbd9edf62b9a098ff271cb08f6dd2a
8524a719200f7b78b5b9f5c2ade9d5f880130b73
/Zestaw3/3.3.cpp
d04e1c92d3a3a8bbb4696b3916267ff87c8f1569
[]
no_license
boojtus/C
be54f6584aed9f007862a95e87e95b87b1fcd421
b8332e20171ef1ed0c14cd72423678d71d293b3d
refs/heads/master
2020-04-26T09:37:36.818514
2019-04-10T20:01:09
2019-04-10T20:01:09
173,462,286
0
0
null
null
null
null
UTF-8
C++
false
false
513
cpp
3.3.cpp
#include <iostream> #include <string> using namespace std; void szukajFrazy( string tekst, string szukanaFraza ) { size_t znalezionaPozycja = tekst.find( szukanaFraza ); if( znalezionaPozycja == string::npos ) { cout << -1 <<endl; } else{cout<<znalezionaPozycja<<endl;} } int main() { string tekst,szukana; cout << "Podaj lancuch 1: "; getline(cin, tekst); cout << "Podaj szukany "; getline(cin, szukana); szukajFrazy(tekst, szukana); return 0; }
cc4102b50fc6e4ab27641974a26d359c80446233
448e26486e76ae36b1c012fd93dc109b4045a7d1
/src/eve-server/system/.svn/text-base/BubbleManager.cpp.svn-base
9029822a05e9b61b0acd3532f062152ce10e401b
[]
no_license
AlTahir/Apocrypha_combo
2aa43ea8c099fbd273eac79b579da91194f9bf20
1931f4404ed3d106e714e64329da8d047ca7f44a
refs/heads/master
2016-09-05T18:40:51.296158
2012-03-19T07:15:44
2012-03-19T07:15:44
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,065
BubbleManager.cpp.svn-base
/* ------------------------------------------------------------------------------------ LICENSE: ------------------------------------------------------------------------------------ This file is part of EVEmu: EVE Online Server Emulator Copyright 2006 - 2008 The EVEmu Team For the latest information visit http://evemu.mmoforge.org ------------------------------------------------------------------------------------ This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, or go to http://www.gnu.org/copyleft/lesser.txt. ------------------------------------------------------------------------------------ Author: Zhur */ #include "EVEServerPCH.h" //upon this interval, check for entities which may have wandered out of their bubble without a major event happening. static const uint32 BubbleWanderTimer_S = 30; static const double BubbleRadius_m = 1e6; //made up... BubbleManager::BubbleManager() : m_wanderTimer(BubbleWanderTimer_S *1000) { m_wanderTimer.Start(); } BubbleManager::~BubbleManager() { clear(); } void BubbleManager::clear() { std::vector<SystemBubble *>::const_iterator cur, end; cur = m_bubbles.begin(); end = m_bubbles.end(); for(; cur != end; cur++) { delete *cur; } m_bubbles.clear(); } void BubbleManager::Process() { if(m_wanderTimer.Check()) { std::vector<SystemEntity *> wanderers; { std::vector<SystemBubble *>::const_iterator cur, end; cur = m_bubbles.begin(); end = m_bubbles.end(); for(; cur != end; ++cur) { if((*cur)->IsEmpty()) { //TODO: nuke this bubble. } //if wanderers are found, they are (*cur)->ProcessWander(wanderers); } } if(!wanderers.empty()) { std::vector<SystemEntity *>::const_iterator cur, end; cur = wanderers.begin(); end = wanderers.end(); for(; cur != end; cur++) { Add(*cur, true); } } } } void BubbleManager::UpdateBubble(SystemEntity *ent, bool notify) { SystemBubble *b = ent->Bubble(); if(b != NULL) { if(b->InBubble(ent->GetPosition())) { _log(DESTINY__BUBBLE_TRACE, "Entity %u is still located in bubble %p", ent->GetID(), b); //still in bubble... return; } _log(DESTINY__BUBBLE_TRACE, "Entity %u is no longer located in bubble %p", ent->GetID(), b); b->Remove(ent, notify); } Add(ent, notify); } void BubbleManager::Add(SystemEntity *ent, bool notify) { SystemBubble *in_bubble = _FindBubble(ent->GetPosition()); if(in_bubble != NULL) { in_bubble->Add(ent, notify); return; } //not in any existing bubble. in_bubble = new SystemBubble(ent->GetPosition(), BubbleRadius_m); //TODO: think about bubble colission. should we merge them? m_bubbles.push_back(in_bubble); in_bubble->Add(ent, notify); } void BubbleManager::Remove(SystemEntity *ent, bool notify) { SystemBubble *b = ent->Bubble(); if(b == NULL) { //not in any bubble. _log(DESTINY__BUBBLE_TRACE, "Entity %u is not located in any bubble. Nothing to remove.", ent->GetID()); return; } b->Remove(ent, notify); } //NOTE: this should probably eventually be optimized to use a //spacial partitioning scheme to speed up this search. SystemBubble * BubbleManager::_FindBubble(const GPoint &pos) const { std::vector<SystemBubble *>::const_iterator cur, end; cur = m_bubbles.begin(); end = m_bubbles.end(); for(; cur != end; ++cur) { SystemBubble *b = *cur; if(b->InBubble(pos)) { return(b); } } //not in any existing bubble. return NULL; }
6f6828b4b2419109bcb71fa2f2f18d910b168c6f
5ce3c7e9caab61bb32d198eff0a4700ec34b5474
/hw4/bsubei2.cpp
ba33b43c59c38e8657b81a1bee1485fd24333e6f
[]
no_license
bsubei/CS251
2a7166fdf7e52f8d9b1c8e2e4ded8a1c55079305
eab972f01b852296e776f93736a27a07e01517f8
refs/heads/master
2021-05-28T02:42:41.141466
2015-02-14T20:33:35
2015-02-14T20:33:35
null
0
0
null
null
null
null
UTF-8
C++
false
false
19,328
cpp
bsubei2.cpp
/* ------------------------------------------------ * Copyright 2014 <Basheer Subei> There is no copyright :D * HW4 Alibamazon * Class: CS 251, Fall 2014. * System: Ubuntu 12.04 compiled with g++ * Author: Basheer Subei * This program reads in a list of cities (a graph with undirected weighted edges), * and then takes in a max_num_of_warehouses, and tries to find the locations which that * max_num_of_warehouses will minimize the distances to all the warehouses (including * that same city location itself). * The program will probably use Dijkstra's algorithm to calculate the distances from * each city to all others. It will also use combinations sample code to calculate * all the combinations of cities that it will try. * * I started off sample program Dijkstras.cpp * provided by Prof. Reed for CS 251 * Fall 2014 at UIC and modified it to work for the homework. * ------------------------------------------------- */ #include <stdio.h> // for compiling on Unix #include <cstdlib> #include <iostream> #include <fstream> // For file input #include <cassert> // for assertions #include <cstring> // avoiding using namespace, instead explicitly stating using using using std::cin; using std::cout; using std::endl; using std::ifstream; // preprocessor definitions // Big enough to be "big" but not overflow when used in arithmetic. #define MAX_INT 100007 // Max. length of city name char array #define MAX_STRING_LENGTH 50 #define MAX_COMBINATIONS 10000 // debug mode (prints out debug messages) #define DEBUG_MODE 0 #define TEST_DATA_FILES 0 // function declarations void printStartSequence(); void runAlibamazonAlgorithm(int max_num_of_warehouses); void readInContentFromFiles(int** graph, char** city_names, int num_vertices); void storeEdgeIntoGraph(int** graph, int vertex1, int vertex2, int weight); void display2dArray(int** graph, int num_vertices); int readNumVerticesFromFile(); void findDistancesFromCity( int** graph, int** distances, int start_city, int num_vertices); void combinations(int v[], int** distances, int num_vertices, int min_indices[], float& min_average, int start, int n, int k, int maxk); void findAverageForOneCity(int** distances, float* averages, int num_vertices); void printTableHeader(); int main() { // print welcome message and stuff printStartSequence(); // take the user's input and run the algorithm with it int max_num_of_warehouses = 1; while (max_num_of_warehouses != -1) { cout << "Please enter the maximum number of cities: " << endl; cin >> max_num_of_warehouses; if (max_num_of_warehouses != -1) { printTableHeader(); for (int i = 1; i <= max_num_of_warehouses; i++) { // TODO(basheersubei) run algorithm here runAlibamazonAlgorithm(i); } } } cout << endl << endl << "Done with program... Exiting!" << endl; return 0; } // end main() void runAlibamazonAlgorithm(int max_num_of_warehouses) { // first, we need to know how many vertices we will have // so, we read in that number from the file first int num_vertices = readNumVerticesFromFile(); // dynamically allocate graph, distances 2d array, and citynames array // Graph represented by adjacency matrix, dynamically allocated int** graph = new int*[num_vertices+1]; for (int i = 1; i <= num_vertices; i++) { graph[i] = new int[num_vertices+1]; for (int j = 0; j <= num_vertices; j++) { graph[i][j] = -1; // -1 means no edges } } // array of distance arrays (one for each starting city), dynamic int** distances = new int*[num_vertices+1]; for (int i = 1; i <= num_vertices; i++) { distances[i] = new int[num_vertices+1]; for (int j = 0; j <= num_vertices; j++) { distances[i][j] = -1; // -1 means no distance found } } // array of char arrays containing city names char** city_names = new char*[num_vertices+1]; for (int i = 1; i <= num_vertices; i++) { city_names[i] = new char[MAX_STRING_LENGTH]; } float* averages = new float[num_vertices+1]; for (int i = 1; i <= num_vertices; i++) averages[i] = MAX_INT; // read in city names and distances from file and // construct adjacency list (graph) from city distances readInContentFromFiles(graph, city_names, num_vertices); // echo city names (for debugging) if (DEBUG_MODE) { for (int i = 1; i <= num_vertices; i++) { cout << "cityname[" << i << "] is " << city_names[i] << endl; } } if (DEBUG_MODE) display2dArray(graph, num_vertices); // for debugging // run Dijkstra's algorithm to find minimum // paths from each city to every other city for (int i = 1; i <= num_vertices; i++) findDistancesFromCity(graph, distances, i, num_vertices); if (DEBUG_MODE) display2dArray(distances, num_vertices); // for debugging // TODO(basheersubei) implement the combination finding into a // smarter method whereby an optimal solution (minimum average // distance is found) without having to iterate over all combinations. // Look at simulated annealing for inspiration if (DEBUG_MODE) findAverageForOneCity(distances, averages, num_vertices); // find which warehouse combinations result // in the lowest distance averages (which row combinations in the // distances 2d array) int v[MAX_COMBINATIONS]; // remember to skip first index int* min_indices = new int[max_num_of_warehouses+1]; float min_average = MAX_INT; combinations(v, distances, num_vertices, min_indices, min_average, 1, num_vertices, 1, max_num_of_warehouses); char sorted_city_names[max_num_of_warehouses][MAX_STRING_LENGTH]; for (int i = 0; i < max_num_of_warehouses; i++) { strcpy(sorted_city_names[i], city_names[min_indices[i+1]]); } qsort(sorted_city_names, max_num_of_warehouses, MAX_STRING_LENGTH, ( int(*)(const void *, const void *)) strcmp); for (int i = 0; i < max_num_of_warehouses; i++) { // cout << "cityname[" << i << "] is " << sorted_city_names[i] << endl; } cout << " " << max_num_of_warehouses; cout << "\t\t" << min_average; cout << "\t\t"; for (int i = 0; i < max_num_of_warehouses; i++) { cout << sorted_city_names[i]; if (i != max_num_of_warehouses-1) { cout << " and "; } } cout << endl; // deallocate what's inside graph and graph itself for (int i = 1; i <= num_vertices; i++) { delete[] graph[i]; } delete[] graph; // deallocate what's inside distances and distances itself for (int i = 1; i <= num_vertices; i++) { delete[] distances[i]; } delete[] distances; // deallocate what's inside city_names and city_names itself for (int i = 1; i <= num_vertices; i++) { delete[] city_names[i]; } delete[] city_names; delete[] min_indices; // deallocate averages delete[] averages; } void findAverageForOneCity(int** distances, float* averages, int num_vertices) { for (int i = 1; i <= num_vertices; i++) { float sum = 0; for (int j = 1; j <= num_vertices; j++) sum += distances[i][j]; averages[i] = sum / num_vertices; } // find the min average int min_index; float min = MAX_INT; for (int i = 1; i <= num_vertices; i++) { if (averages[i] < min) { min_index = i; min = averages[i]; } } if (DEBUG_MODE) { cout << " the min is " << min << " and the index is " << min_index << endl; } } // goes through all combinations for n choose k, sets indices of min combo // example: combinations(v, 1, 5, 1, 3); void combinations(int v[], int** distances, int num_vertices, int min_indices[], float& min_average, int start, int n, int k, int maxk) { int i; /* k here counts through positions in the maxk-element v. * if k > maxk, then the v is complete and we can use it. */ if (k > maxk) { /* insert code here to use combinations as you please */ // TODO(basheersubei) then go over all combinations and find the // one with minimum average distance if (DEBUG_MODE) { cout << "min avg: " << min_average << ". "; for (i = 1; i <= maxk; i++) cout << v[i] << " "; } // cout << endl; // TODO(basheersubei) find ways of optimizing this, at least not // having to go through the entire adjacency matrix would save on time // for each combination, find its min average float sum = 0; float average = 0; // maxk tells how many cities in the combination exist // go over every destination (column in distances) called dest // go over every maxk and find out which distances[maxk][i] are min for (int column = 1; column <= num_vertices; column++) { int min_distance = MAX_INT; for (int combination_index = 1; combination_index <= maxk; combination_index++) { // this finds the minimum distance by picking the // closest warehouse to the destination if (min_distance > distances[v[combination_index]][column]) { min_distance = distances[v[combination_index]][column]; } } sum += min_distance; } average = sum / num_vertices; if (DEBUG_MODE) cout << "average: " << average << " "; if (min_average > average) { if (DEBUG_MODE) cout << "smaller than min avg! saving! "; min_average = average; for (int index = 1; index <= maxk; index++) min_indices[index] = v[index]; } if (DEBUG_MODE) cout << endl; return; } /* for this k'th element of the v, try all start..n * elements in that position */ for (i = start; i <= n; i++) { v[k] = i; /* recursively generate combinations of integers * from i+1..n */ combinations(v, distances, num_vertices, min_indices, min_average, i+1, n, k+1, maxk); } } // this function takes in a graph (adjacency matrix), an empty distances 2-d // array, a starting city (starting node in the graph), and the dimension // (number of vertices in the graph). It then calculates the distances to all // the other vertices from the starting vertex (using Dijkstra's algorithm). // It changes the row in distances 2-d array for the start_city to reflect that. // Based off of Prof. Reed's sample code Dijkstras.cpp modified to use Adjacency // Matrix instead of adjacency lists. void findDistancesFromCity( int** graph, int** distances, int start_city, int num_vertices) { // Node *pTemp; // temporary graph node pointer bool* isInTree = new bool[num_vertices+1]; // Marks if vertex is in tree int* distance = new int[num_vertices+1]; // Min distance found so far int currentVertex; // current vertex to process int adjacentVertex; // Adjacent vertex int weight; // edge weight // shortest distance of some new node from current int shortest_new_distance; // Initialize all vertices as not being in the tree, having max distance for (int i = 1; i <= num_vertices; i++) { isInTree[i] = false; distance[i] = MAX_INT; } // Set values for starting node distance[start_city] = 0; currentVertex = start_city; // main loop, continued until all vertices are handled while (isInTree[currentVertex] == false) { isInTree[currentVertex] = true; // Include current vertex into tree // Examine in turn each edge incident to the current vertex // wherever graph[currentVertex][i] > 0 for (int adjacentVertex = 1; adjacentVertex <= num_vertices; adjacentVertex++) { // if there's an edge from currentVertex to adjacentVertex if (graph[currentVertex][adjacentVertex] > 0) { // now check if this is the closest weight = graph[currentVertex][adjacentVertex]; if (distance[adjacentVertex] > (distance[currentVertex] + weight) ) { // Store new lower-cost distance distance[ adjacentVertex] = distance[currentVertex] + weight; } } } // Find next vertex to be processed. It should be the closest one // not already in tree. if this doesn't get changed, it makes the // while condition false currentVertex = 1; shortest_new_distance = MAX_INT; // Initialize to some large number // Examine each vertex in graph for (int i = 1; i <= num_vertices; i++) { if ((isInTree[i] == false) && (shortest_new_distance > distance[i])) { // This ith vertex is not yet in tree and is closest so far // set new shortest distance shortest_new_distance = distance[i]; currentVertex = i; // set new closest vertex } } // end for( int i... } // end while( isInTre... // Display distance from start to each other node if (DEBUG_MODE) { cout << "Distance from " << start_city\ << " to each other node is:" << endl; for (int i = 1; i <= num_vertices; i++) { cout << i << ": " << distance[ i] << endl; } cout << endl; } // set that row in distances to this distance that we found (basically // the distance to all cities from start_city) // we need to copy them over, because we have to delete distance array, // which we dynamically allocated only within this function. memcpy(&distances[start_city][1], &distance[1], num_vertices * sizeof(int)); delete[] isInTree; delete[] distance; } //----------------------------------------------------------------------------- // Display adjacencyMatrix associated with each vertex void display2dArray(int** graph, int num_vertices) { for (int i = 1; i <= num_vertices; i++) { for (int j = 1; j <= num_vertices; j++) { cout << graph[i][j] << "\t"; } cout << endl; } } // end display2dArray(...) //----------------------------------------------------------------------------- // Store vertex1 into the adjacency list for vertex2, and vertex2 into the // adjacency list for vertex1. void storeEdgeIntoGraph( int** graph, // Array of adjacency list heads int vertex1, // First vertex of edge being added int vertex2, // Second vertex of edge being added int weight) { // weight of edge to add // just add two entries in adjacency matrix with the weight graph[vertex1][vertex2] = weight; graph[vertex2][vertex1] = weight; // store zero distances for the edge between a vertex and itself graph[vertex1][vertex1] = 0; graph[vertex2][vertex2] = 0; } // end storeEdgeIntoGraph(...) int readNumVerticesFromFile() { ifstream inStream; // input file stream if (TEST_DATA_FILES) inStream.open("small_city_names.txt"); else inStream.open("CityNames.txt"); assert(!inStream.fail() ); // make sure file open was OK int num_vertices; // read the number of cities from the first line inStream >> num_vertices; inStream.close(); return num_vertices; } //----------------------------------------------------------------------------- // Read in the city names from one file and the list of distances between // pairs of cities from another file, storing these pairs into the adjacency // matrix graph as we go. // taken from bfs.cpp from Prof. Reed's sample code, heavily modified void readInContentFromFiles(int** graph, char** city_names, // Array of 2 char city names int num_vertices) { // Number of vertices in graph ifstream inStream; // input file stream if (TEST_DATA_FILES) inStream.open("small_city_names.txt"); else inStream.open("CityNames.txt"); assert(!inStream.fail() ); // make sure file open was OK // to read in first line (not used, since it was done before) char* junk = new char[10]; inStream.getline(junk, 10); // fixes bug where it wasn't going to next line if (DEBUG_MODE) cout << "junk is " << junk << endl; delete[] junk; // Now read the city names for (int i = 1; i <= num_vertices; i++) { inStream.getline(city_names[i], MAX_STRING_LENGTH); // now get rid of the return carriage char char *s = city_names[i]; while (*s && *s != '\n' && *s != '\r') s++; *s = 0; } inStream.close(); // Now read in the distance values if (TEST_DATA_FILES) inStream.open("small_city_distances.txt"); else inStream.open("CityDistancesSanitized.txt"); assert(!inStream.fail() ); // make sure file open was OK // First read the number of distance pairs from the first line int num_edges; int fromCity, toCity, distance; inStream >> num_edges; // Now read the distance pairs and store in adjacency lists for (int i = 0; i < num_edges; i++) { inStream >> fromCity >> toCity >> distance; // weight of node is distance, store Node in graph storeEdgeIntoGraph(graph, fromCity, toCity, distance); } inStream.close(); } // end readInContentFromFiles(...) void printTableHeader() { cout << "\t\tAvg City\n"\ << " #\t\tDistance\tCities\n"\ << "---\t\t---------\t--------------------" << endl; } // prints a bunch of introduction text void printStartSequence() { cout << endl; cout << "Welcome to the program!" << endl; cout << "Author: Basheer Subei" << endl; cout << "TA: Nianzu, Lab: 10 am Thursday" << endl; cout << "CS 251 Fall 2014" << endl; cout << "Program: #4, Alibamazon" << endl; cout << "Built on Ubuntu 12.04, compiled using g++ v4.6.3" << endl; cout << endl; }
b099a3e0c39b6239b5a5046ee6eb5b0ff0e7f3f2
7e23939a2c114d2dedad2374e01aeba5f7cf9b48
/libraries/OffChip/NRF24L01/两机通讯(中断)/FourAxisByStm32(接收)/Lib/FIFOBuffer.h
26cc408c685cbd0e3b1454b974ae3bc565c0522a
[]
no_license
InfiniteYuan/STM32F103DriverLib
7c34341c2ac16227e3921fec424727cb224bc6d7
fab4f38aa3d24112e14843d503d75923ab37a541
refs/heads/master
2021-09-21T11:49:35.390485
2018-08-01T16:07:23
2018-08-01T16:07:23
93,494,975
10
7
null
null
null
null
UTF-8
C++
false
false
4,035
h
FIFOBuffer.h
/** *@file FIFOBuffer.h *@author cq_dan3 2015-10-20 first creat FIFOBuffer class * Neutree 2015-10-28 add comments for FIFOBuffer class *@version v1.1 *@brief A template for FIFO queue *@copyright CQUTIOTLIB all right reserved * */ #ifndef _FIFO_BUFFER_H_ #define _FIFO_BUFFER_H_ #include "stm32f10x.h" /** *@breif A FIFO queue Template for FIFO application * * */ template<typename T, u16 MAX_SIZE> class FIFOBuffer { private: T _buf[MAX_SIZE]; //fifo buffer data u16 _max_size; //max buffer size u16 _size; //current buffer nodes u16 _out_idx; //output index of buffer u16 _in_idx; //input index of buffer public: ///////////////////////// ///@breif constructor ///////////////////////// FIFOBuffer(); ///////////////////////// ///@breif put node data to queue ///@param data the node data will put into queue //////////////////////// bool Put(const T &data); //////////////////////// ///@breif get one node data from queue,the length of queue will decrease one ///@param data the destination of node data from queue //////////////////////// bool Get(T &data); ////////////////////////////// ///@breif put multiple node data to queue ///@param pdata the first node data adress of node data array will put into queue ///@param num the length of node data that will put into queue ///////////////////////////// bool Puts(T *pData, u16 num); ////////////////////////////// ///@breif get multiple node data to queue ///@param pdata the first node data adress of node data array will get from the queue ///@param num the length of node data that will get from the queue ///////////////////////////// bool Gets(T *pData, u16 num); //////////////////////////// ///@breif get the size of queue ///@retval the size of queue /////////////////////////// u16 Size(); //////////////////////////////// ///@breif clear the queue //////////////////////////////// void Clear(); }; template<typename T, u16 MAX_SIZE> FIFOBuffer<T, MAX_SIZE>::FIFOBuffer() { _max_size = MAX_SIZE; //max buffer size _size = 0; //current buffer nodes _out_idx = 0; //output index of buffer _in_idx = 0; //input index of buffer } //input one node to buffer template<typename T, u16 MAX_SIZE> bool FIFOBuffer<T, MAX_SIZE>::Put(const T &data) { if (_size >= _max_size) //buffer overflow return false; _buf[_in_idx++] = data; //input data if (_in_idx >= _max_size) //input index validate _in_idx = 0; _size++; //update buffer size return true; } //input multi nodes to buffer template<typename T, u16 MAX_SIZE> bool FIFOBuffer<T, MAX_SIZE>::Puts(T *pData, u16 num) { if ((_size + num) > _max_size) //buffer overflow return false; for (u16 i = 0; i < num; i++) { _buf[_in_idx++] = pData[i]; //input data if (_in_idx >= _max_size) //input index validate _in_idx = 0; } _size += num; //update buffer size return true; } //get one node from buffer template<typename T, u16 MAX_SIZE> bool FIFOBuffer<T, MAX_SIZE>::Get(T &data) { if (_size <= 0) //no data to get return false; data = _buf[_out_idx++]; //output data if (_out_idx >= _max_size) //output index validate _out_idx = 0; _size--;//update buffer size return true; } //get multi nodes from buffer template<typename T, u16 MAX_SIZE> bool FIFOBuffer<T, MAX_SIZE>::Gets(T *pData, u16 num) { if (_size < num) return false; //not enough data to get for (u16 i = 0; i < num; i++) { pData[i] = _buf[_out_idx++]; //output data if (_out_idx >= _max_size) //output index validate _out_idx = 0; } _size -= num;//update buffer size return true; } //Get the number of nodes in buffer (_size) template<typename T, u16 MAX_SIZE> u16 FIFOBuffer<T, MAX_SIZE>::Size() { return _size; } //clear all nodes in buffer template<typename T, u16 MAX_SIZE> void FIFOBuffer<T, MAX_SIZE>::Clear() { _size = 0; //current buffer nodes _out_idx = 0; //output index of buffer _in_idx = 0; //input index of buffer } #endif
a63ca5b788ed8e4463581133315142f089e481a8
664e84659fbbbe4f97c1740b28a4ddda8ea2b624
/include/gsound/internal/QBVHArrayTreeNode.h
6a01e7e7d23752aefe82d17a452f479f5b6e2af9
[]
no_license
SoundSight/SoundSight
baeaa0dd26d454eeb859efe1b6091cc0b61761fa
0dd3a1c5a8824173de0174133d56279c8497457f
refs/heads/master
2021-01-01T05:14:53.424886
2016-05-27T05:12:34
2016-05-27T05:12:34
59,781,138
2
0
null
null
null
null
UTF-8
C++
false
false
13,411
h
QBVHArrayTreeNode.h
/* * Project: GSound * * File: gsound/internal/QBVHArrayTreeNode.h * * Version: 1.0.0 * * Contents: gsound::internal::QBVHArrayTreeNode class declaration * * License: * * Copyright (C) 2010-12 Carl Schissler, University of North Carolina at Chapel Hill. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for educational, research, and non-profit purposes, without * fee, and without a written agreement is hereby granted, provided that the * above copyright notice, this paragraph, and the following four paragraphs * appear in all copies. * * Permission to incorporate this software into commercial products may be * obtained by contacting the University of North Carolina at Chapel Hill. * * This software program and documentation are copyrighted by Carl Schissler and * the University of North Carolina at Chapel Hill. The software program and * documentation are supplied "as is", without any accompanying services from * the University of North Carolina at Chapel Hill or the authors. The University * of North Carolina at Chapel Hill and the authors do not warrant that the * operation of the program will be uninterrupted or error-free. The end-user * understands that the program was developed for research purposes and is advised * not to rely exclusively on the program for any reason. * * IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR ITS * EMPLOYEES OR THE AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, * SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE * UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE AUTHORS HAVE BEEN ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * * THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS SPECIFICALLY * DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY * STATUTORY WARRANTY OF NON-INFRINGEMENT. THE SOFTWARE PROVIDED HEREUNDER IS * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND * THE AUTHORS HAVE NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, * ENHANCEMENTS, OR MODIFICATIONS. * * * Contact Information: * * Please send all bug reports and other contact to: * Carl Schissler * carl.schissler@gmail.com * * Updates and downloads are available at the main GSound web page: * http://gamma.cs.unc.edu/GSOUND/ * */ #ifndef INCLUDE_GSOUND_QBVH_ARRAY_TREE_NODE_H #define INCLUDE_GSOUND_QBVH_ARRAY_TREE_NODE_H #include "GSoundInternalConfig.h" #include "InternalSoundTriangle.h" //########################################################################################## //************************** Start GSound Internal Namespace ***************************** GSOUND_INTERNAL_NAMESPACE_START //****************************************************************************************** //########################################################################################## class GSOUND_ALIGN(128) QBVHArrayTreeNode { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Type Definitions typedef InternalSoundTriangle TriangleType; /// Define the type of data structure to use for SIMD axis-aligned bounding boxes. typedef math::SIMDAABB3D<Float,4> SIMDAABB3; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Children Accessor Method /// Get the left child of this QBVH node with the specified index. GSOUND_FORCE_INLINE QBVHArrayTreeNode* getChild( Index child ) { GSOUND_DEBUG_ASSERT_MESSAGE( child < 4, "Cannot get QBVHArrayTreeNode child with invalid index." ); return this + firstChildOffset[child]; } /// Get the left child of this QBVH node with the specified index. GSOUND_FORCE_INLINE const QBVHArrayTreeNode* getChild( Index child ) const { GSOUND_DEBUG_ASSERT_MESSAGE( child < 4, "Cannot get QBVHArrayTreeNode child with invalid index." ); return this + firstChildOffset[child]; } /// Get a SIMD scalar containing the integer offsets from this node of this node's children. GSOUND_FORCE_INLINE SIMDInt getChildOffsets() const { return SIMDInt( (const int*)firstChildOffset ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Node Attribute Accessor Methods /// Get an integer which specifies the specified split axis of the node. /** * Indices range from 0 to 2. The split with index 0 is the split that * was used to partition this node's triangles into two sets. The split * with index 1 is the secondary split for the lesser half of the node, * and the index 2 split is for the greater half of the node. */ GSOUND_FORCE_INLINE Index getSplitAxis( Index splitIndex ) const { GSOUND_DEBUG_ASSERT_MESSAGE( splitIndex < 3, "Cannot get QBVHArrayTreeNode split axis with invalid index." ); return splitAxis[splitIndex]; } /// Return whether or not the specified child is a leaf node. GSOUND_FORCE_INLINE Bool isLeaf( Index child ) const { GSOUND_DEBUG_ASSERT_MESSAGE( child < 4, "Cannot get QBVHArrayTreeNode leaf status with invalid index." ); return (flags[child] & LEAF_NODE_FLAG); } /// Return a SIMD mask indicating whether or not each node is a leaf. GSOUND_FORCE_INLINE SIMDBool getLeafMask() const { const SIMDInt leafMask( LEAF_NODE_FLAG, LEAF_NODE_FLAG << 8, LEAF_NODE_FLAG << 16, LEAF_NODE_FLAG << 24 ); return (SIMDInt(*(const int*)flags) & leafMask) == leafMask; } /// Return whether or not the specified child is an empty node. GSOUND_FORCE_INLINE Bool isEmpty( Index child ) const { GSOUND_DEBUG_ASSERT_MESSAGE( child < 4, "Cannot get QBVHArrayTreeNode empty status with invalid index." ); return flags[child] == LEAF_NODE_FLAG; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Volume Accessor Methods /// Get the set of SIMD axis-aligned bounding boxes for this quad node. GSOUND_FORCE_INLINE const SIMDAABB3& getVolumes() const { return volumes; } /// Get the axis-aligned bounding box that encompases the whole node. /** * The bounding box is computed from scratch each time so this method * should not be used in performance-intensive code. */ AABB3 getVolume() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Triangle Accessor Methods /// Get an offset into the triangle array for this tree that indicates the start of a leaf's triangles. GSOUND_FORCE_INLINE UInt32 getTriangleStartIndex( Index child ) const { GSOUND_DEBUG_ASSERT_MESSAGE( child < 4, "Cannot get QBVHArrayTreeNode triangle start with invalid child index." ); return triangleIndex[child]; } /// Get the number of triangles that this node contains (if it is a leaf). GSOUND_FORCE_INLINE Size getNumberOfTriangles( Index child ) const { GSOUND_DEBUG_ASSERT_MESSAGE( child < 4, "Cannot get QBVHArrayTreeNode triangle count with invalid child index." ); return Size(flags[child] & TRIANGLE_COUNT_MASK); } /// Get a SIMD integer representing the number of triangles that each child node contains (if it is a leaf). GSOUND_FORCE_INLINE SIMDInt getNumberOfTriangles() const { SIMDInt triangleCountMask( TRIANGLE_COUNT_MASK, TRIANGLE_COUNT_MASK << 8, TRIANGLE_COUNT_MASK << 16, TRIANGLE_COUNT_MASK << 24 ); SIMDInt counts = SIMDInt(*(const int*)flags) & triangleCountMask; return (counts | (counts >> 8) | (counts >> 16) | (counts >> 24)) & SIMDInt(TRIANGLE_COUNT_MASK); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructors QBVHArrayTreeNode( const StaticArray<AABB3,4>& newVolumes, const StaticArray<Index,4>& newIndices, const StaticArray<Bool,4>& isALeaf, const StaticArray<Size,4>& numLeafTriangles, const StaticArray<Index,3>& splitAxes ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Accessor Methods /// Set an offset into the triangle array for this tree that indicates the start of a leaf's triangles. GSOUND_FORCE_INLINE void setTriangleStartIndex( Index child, UInt32 index ) { GSOUND_DEBUG_ASSERT_MESSAGE( child < 4, "Cannot set QBVHArrayTreeNode triangle start with invalid child index." ); triangleIndex[child] = index; } /// Set the number of triangles that this node contains (if it is a leaf). GSOUND_FORCE_INLINE void setNumberOfTriangles( Index child, Size numTriangles ) { GSOUND_DEBUG_ASSERT_MESSAGE( child < 4, "Cannot set QBVHArrayTreeNode triangle count with invalid child index." ); flags[child] = (flags[child] & LEAF_NODE_FLAG) | (UInt8)numTriangles; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A set of SIMD axis-aligned bounding boxes for this quad node. SIMDAABB3 volumes; union { /// The relative index of the first children of each of the 4 sub-nodes. UInt32 firstChildOffset[4]; /// The index within the master triangle list of the start of the leaf-node triangle list. UInt32 triangleIndex[4]; /// The index value to use when it doesn't semantically matter whether the index is a child or a triangle. UInt32 indices[4]; }; /// The axes along which this node was split to produce its children. /** * The index of the split axis indicates the axis along which it was split: * (0 = X, 1 = Y, 2 = Z). */ UInt32 splitAxis[3]; /// A 32 bit integer value containing flags for this node. UInt8 flags[4]; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members static const UInt8 LEAF_NODE_FLAG = 0x80; static const UInt8 TRIANGLE_COUNT_MASK = 0x7F; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Friend Declaration /// Declare the QBVHArrayTree class as a friend so that it can access a private constructor. friend class QBVHArrayTree; }; //########################################################################################## //************************** End GSound Internal Namespace ******************************* GSOUND_INTERNAL_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_GSOUND_QBVH_ARRAY_TREE_NODE_H
dd81a2eab22dd0717a8469d663daba94416e2a4b
122e5704831d1725a7c416a2499e95981cc4f632
/uvc/src/usb_isoch.cpp
84612b89de0a377ecb8f9e7c112342ee42229449
[]
no_license
webstorage119/uvc_scanner
01e91d8f2491f0161c5638fd95056ab7f17b82c6
0c9d04443ac2409fa3089faa88259760fc6148df
refs/heads/master
2021-05-30T10:20:30.094546
2016-01-19T08:55:51
2016-01-19T08:55:51
null
0
0
null
null
null
null
UTF-8
C++
false
false
8,734
cpp
usb_isoch.cpp
/* Copyright (c) 2010 Max Grosse (max.grosse(at)ioctl.eu) This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "usb_isoch.h" namespace usb { #if 0 const size_t COND_THRES = 8; #endif void isoch_request::iso_callback(void* refcon, IOReturn result, void* arg0) { isoch_request *req = (isoch_request*)refcon; isoch_transfer *transfer = req->transfer; req->done = true; //uint64_t latest_frame_num = req->frame_num; //printf("CALLBACK processing %llu / %llx\n",req->frame_num,(uint64_t)req); if(req->ZOMBIE) { //printf("STILL ALIIIVE!\n");fflush(stdout); /* ignore this packet */ return; } // no longer outstanding transfer->req_outstanding_.erase(req); #if 0 pthread_mutex_lock(&(transfer->mutex_unprocessed_)); transfer->req_done_.insert(req); if(transfer->req_done_.size() > COND_THRES) { pthread_mutex_lock(&(transfer->mutex_data_avail_)); pthread_cond_signal(&(transfer->cond_data_avail_)); pthread_mutex_unlock(&(transfer->mutex_data_avail_)); } pthread_mutex_unlock(&(transfer->mutex_unprocessed_)); #endif transfer->req_done_->push(req); // no longer outstanding //transfer->req_outstanding_.erase(req); if(transfer->should_stop_) { //if(transfer->req_outstanding_.empty()) { if(transfer->req_outstanding_.size()==0) { /*** TODO: this is not hit???? ***/ CFRunLoopStop(CFRunLoopGetCurrent()); } else { //printf("CALLBACK->still %lu requests to go...\n",transfer->req_outstanding_.size()); request_set::iterator iter = transfer->req_outstanding_.begin(); for(;iter!=transfer->req_outstanding_.end();++iter) { isoch_request *ir = *iter; //printf("## frame_num=%llu\n",ir->frame_num); } } } else { isoch_request *nreq = new isoch_request(transfer); transfer->req_outstanding_.insert(nreq); } } /* *isoch_requst* */ isoch_request::isoch_request(isoch_transfer* tf) : transfer(tf), done(false), ZOMBIE(false) { /** allocate memory stuff */ frame_list = new IOUSBIsocFrame[transfer->num_muframes_]; buffer = new uint8_t[transfer->pipe_size_ * transfer->num_muframes_]; //memset(buffer, 0, transfer->pipe_size_*transfer->num_muframes_); for(int i=0; i<transfer->num_muframes_; ++i) { frame_list[i].frStatus = 0; frame_list[i].frReqCount = transfer->pipe_size_; frame_list[i].frActCount = 0; } /* launch */ retry: kern_return_t ret = transfer->intf_->read_isoch(1, buffer, transfer->current_frame_, transfer->num_muframes_, frame_list, isoch_request::iso_callback, this); if(ret) { if(ret==kIOUSBPipeStalled) { printf("STALL, YUCK!\n"); transfer->intf_->clear_stall_both_ends(1); goto retry; } else if(ret==kIOReturnIsoTooOld) { printf("TOO OLD, YUCK!\n"); transfer->current_frame_ = transfer->intf_->bus_frame_number() + 50; goto retry; } else { printf("WTF? %x=%s\n",ret, iokit_error_to_string(ret)); throw exception("EPIC FAIL", ret); } } frame_num = transfer->current_frame_; transfer->current_frame_ += transfer->num_frames_; } isoch_request::~isoch_request() { if(!done) { printf("**** TRYING TO DELETE REQUEST WHICH HAS NOT HAVE IT'S CALLBACK *****\n"); printf("**** AT: 0x%llx\n ****\n",(uint64_t)this); fflush(stdout); } //printf(">>> DELETING ISOCH_REQUEST %llx\n",(uint64_t)this); delete [] frame_list; delete [] buffer; transfer = NULL; } /* *isoch_transfer* */ isoch_transfer::isoch_transfer(interface *intf, uint32_t pipe_size) : intf_(intf), pipe_size_(pipe_size), running_(false) { /* assume, alternate is already set correctly!!! */ /* globals */ num_frames_ = 5; num_muframes_ = num_frames_*8; num_reqs_ = 10; req_done_ = new request_rb(100,5); #if 0 /* init global mutex on unprocessed list */ if(pthread_mutex_init(&mutex_unprocessed_, NULL)) { throw exception("failed initializing mutex"); } if(pthread_mutex_init(&mutex_data_avail_, NULL)) { throw exception("failed initializing mutex"); } if(pthread_cond_init(&cond_data_avail_, NULL)) { throw exception("failed initializing condition"); } #endif } isoch_transfer::~isoch_transfer() { #if 0 pthread_mutex_lock(&mutex_unprocessed_); pthread_mutex_lock(&mutex_data_avail_); #endif /* clear outstanding */ if(!req_outstanding_.empty()) { printf("** There where still outstanding requests (should NEVER happen)?? --> %lu\n",req_outstanding_.size()); for(request_set::iterator i=req_outstanding_.begin(); i!=req_outstanding_.end(); ++i) { isoch_request *req = *i; //delete req; /*** NOTE: This results in a LEAK but because of some WEIRD behavior, everything is going to crash if we delete it here... ?? ***/ req->ZOMBIE = true; } req_outstanding_.clear(); } #if 0 if(!req_done_.empty()) { printf("** There where still unprocessed requests??\n"); for(request_set::iterator i=req_done_.begin(); i!=req_done_.end(); ++i) { isoch_request *req = *i; delete req; } req_done_.clear(); } pthread_mutex_destroy(&mutex_unprocessed_); pthread_mutex_destroy(&mutex_data_avail_); pthread_cond_destroy(&cond_data_avail_); #endif delete req_done_; } void isoch_transfer::start() { /* launch new thread */ pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); if(running_) { printf("ALREADY RUNNING!\n"); return; } running_ = true; should_stop_ = false; if(pthread_create(&worker_thread_, &attr, isoch_transfer::worker_func, (void*)this)) { printf("Thread creation FAILED (isoch_transfer)\n"); running_ = false; } } void isoch_transfer::stop() { intf_->abort_pipe(1); usleep(50*1000); //printf("TRANSFER GOING DOWN...waiting for worker_thread to join...\n"); should_stop_ = true; pthread_join(worker_thread_, NULL); //printf("TRANSFER GOING DOWN...JOINED\n"); running_ = false; #if 0 /* signal decoder to finish */ pthread_mutex_lock(&(mutex_data_avail_)); pthread_cond_signal(&(cond_data_avail_)); pthread_mutex_unlock(&(mutex_data_avail_)); #endif } void* isoch_transfer::worker_func(void* vme) { isoch_transfer *me = (isoch_transfer*)vme; //printf("ENTER worker_func, isoch_transfer=0x%llx\n", (uint64_t)me); me->req_done_->begin(); /* cf run loop set up */ CFRunLoopSourceRef source; me->intf_->async_event_source(&source); CFRunLoopAddSource( CFRunLoopGetCurrent(), source, kCFRunLoopDefaultMode ); /* transfer set-up */ me->current_frame_ = me->intf_->bus_frame_number(); // be safe: me->current_frame_ += 100; me->intf_->clear_stall_both_ends(); /* GO and LAUNCH that transfers! */ for(int i=0; i<me->num_reqs_; ++i) { isoch_request *req = new isoch_request(me); me->req_outstanding_.insert(req); } /* wait for callbacks */ //CFRunLoopRun(); while(!me->should_stop_) { CFRunLoopRunInMode(kCFRunLoopDefaultMode, 2, false); } /* done */ CFRunLoopStop(CFRunLoopGetCurrent()); CFRunLoopRemoveSource( CFRunLoopGetCurrent(), source, kCFRunLoopDefaultMode ); #if 0 /* better signal 'em */ // beter signal decoder threads pthread_cond_signal(&(me->cond_data_avail_)); pthread_mutex_unlock(&(me->mutex_data_avail_)); #endif me->req_done_->end(); return NULL; } #if 0 /** start_process. Requests permission to * process all returned requests. * After calling this, you should as fast as * possible call end_process() so processing * can continue. best to first copy/move all stuff * **/ request_set* isoch_transfer::start_process() { pthread_mutex_lock(&mutex_unprocessed_); return &req_done_; } void isoch_transfer::end_process() { pthread_mutex_unlock(&mutex_unprocessed_); } void isoch_transfer::wait_for_data() { if(!running_) return; pthread_mutex_lock(&mutex_data_avail_); pthread_cond_wait(&cond_data_avail_, &mutex_data_avail_); pthread_mutex_unlock(&mutex_data_avail_); } #endif }
277dc9d6d74eae0dd6ad914fedb304a645f8940d
cdd4ac1fad969dec8ca2230346b4176c074306d7
/chrome/browser/sync/glue/chrome_report_unrecoverable_error.cc
fe329bb77aca6b4aed495e46a77f60a195d0743f
[ "BSD-3-Clause" ]
permissive
cha63506/chromium-16
8030101e2ff4e1319d64821296def926c0fae585
681563ea0f892a051f4ef3d5e53438e0bb7d2261
HEAD
2017-05-24T09:56:16.628442
2012-03-29T14:49:30
2012-03-29T14:49:30
null
0
0
null
null
null
null
UTF-8
C++
false
false
656
cc
chrome_report_unrecoverable_error.cc
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" #include "build/build_config.h" #if defined(OS_WIN) #include <windows.h> #endif #include "chrome/common/chrome_constants.h" namespace browser_sync { void ChromeReportUnrecoverableError() { // This currently works on windows platform but is disabled for now. // TODO(lipalani): Add this for other platforms as well. // TODO(lipalani) : Re-enable error reporting on trunk. } } // namespace browser_sync
8ce2c942d2e09871c9cb987af74582cbfa832b62
a30d09985c3bbe308db025eb5358f375e9906e69
/src/ros_cyton_pkg/include/measure/ecObstProxFunction.h
2e83d3bce9d0f5c65a71ce96d108981db7343319
[]
no_license
shelderzhang/ros_cyton_gamma
d86bb61bb6796aa8c49d61031fe23065d2bbb80d
fbadcc333518ea0522368be9bdb3e36d0c828dbf
refs/heads/master
2021-01-18T10:21:13.524783
2014-09-05T21:04:16
2014-09-05T21:04:16
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,036
h
ecObstProxFunction.h
#ifndef ecObstProxFunction_H_ #define ecObstProxFunction_H_ //------------------------------------------------------------------------------ // Copyright (c) 2002-2013 Energid Technologies. All rights reserved. // /// @file ecObstProxFunction.h /// @class EcObstacleProximityFunction /// @brief Provides a measure of proximity to obstacles. // //------------------------------------------------------------------------------ #include <actin/actin_config.h> // Required to be first header. #include <foundCore/ecTypes.h> #include <foundCore/ecConstants.h> #include "ecScalarManipFunction.h" #include <geometry/ecCapsule.h> // forward declarations class EcIndividualManipulator; /** Provides a measure of proximity to obstacles. */ class EC_ACTIN_MEASURE_DECL EcObstacleProximityFunction : public EcScalarManipulatorFunction { public: /// default constructor EcObstacleProximityFunction ( ); /// destructor virtual ~EcObstacleProximityFunction ( ); /// copy constructor EcObstacleProximityFunction ( const EcObstacleProximityFunction& orig ); /// assignment operator EcObstacleProximityFunction& operator= ( const EcObstacleProximityFunction& orig ); /// gets a pointer to the manipulator virtual const EcIndividualManipulator* manipulator ( ) const; /// sets the manipulator pointer virtual void setManipulator ( const EcIndividualManipulator* pManipulator ); /// gets a pointer to the capsules virtual const EcCapsuleVector* capsules ( ) const; /// sets the pointer to the capsules virtual void setCapsules ( const EcCapsuleVector* capsules ); /// gets the exponent virtual EcReal exponent ( ) const; /// sets the exponent virtual void setExponent ( EcReal exponent ); /// gets the boundary value virtual EcReal boundaryValue ( ) const; /// sets the boundary value virtual void setBoundaryValue ( EcReal boundaryValue ); /// gets the cutoff distance virtual EcReal avoidanceDistance ( ) const; /// sets the cutoff distance virtual void setAvoidanceDistance ( EcReal avoidanceDistance ); /// evaluate the function using an active state virtual EcReal evaluate ( EcManipulatorActiveState& actState, EcBoolean nominal = EcTrue ) const; /// get a null object static EcObstacleProximityFunction nullObject ( ); protected: /// a pointer to the manipulator const EcIndividualManipulator* m_pManipulator; /// a pointer to a vector of capsules enclosing obstacles const EcCapsuleVector* m_pCapsules; /// the exponent of a polynomial function EcXmlReal m_Exponent; /// the value at a bounding volume boundary EcReal m_BoundaryValue; /// the cutoff distance EcReal m_AvoidanceDistance; }; #endif // ecObstProxFunction_H_
e65c20e004ae63da257e520c7654989d9e3d1b34
c9b02ab1612c8b436c1de94069b139137657899b
/rpg/app/battle/WWMParser.h
3d2be7313eca1718f5b8b8bbb18b754681cb6d47
[]
no_license
colinblack/game_server
a7ee95ec4e1def0220ab71f5f4501c9a26ab61ab
a7724f93e0be5c43e323972da30e738e5fbef54f
refs/heads/master
2020-03-21T19:25:02.879552
2020-03-01T08:57:07
2020-03-01T08:57:07
138,948,382
1
1
null
null
null
null
UTF-8
C++
false
false
1,536
h
WWMParser.h
#ifndef _WWM_PARSER_H_ #define _WWM_PARSER_H_ #include <string> #include <map> #include <vector> using namespace std; class WWMParser { public: static WWMParser* getInstance(const string& path); private: WWMParser(); bool parse(const string& path); public: uint32_t getWidth() const { return width; } uint32_t getHeight() const { return height; } uint32_t getGridWidth() const { return grid_width; } uint32_t getGridHeight() const { return grid_height; } bool isMoveable(uint32_t x, uint32_t y); private: static map<string, WWMParser*> wwmParsers; private: uint32_t width; uint32_t height; uint32_t grid_width; //格子大小 uint32_t grid_height; vector<byte> cells; public: class MapReader { public: MapReader(const char *ptr, uint32_t len) { ptr_ = ptr; len_ = len; pos_ = 0; } bool GetInt32(uint32_t &v) { if (pos_ + 4 > len_) { return false; } memcpy(&v, ptr_ + pos_, 4); pos_ += 4; return true; } bool GetByte(byte &v) { if (pos_ + 1 > len_) { return false; } v = static_cast<unsigned char>(*(ptr_ + pos_)); pos_ += 1; return true; } bool GetSize(uint32_t &v) { byte len = 0; if (!GetByte(len)) { return false; } if (len < 255) { v = len; return true; } return GetInt32(v); } bool SetPos(uint32_t p) { if (p > len_) { return false; } pos_ = p; return true; } uint32_t GetPos() { return pos_; } private: uint32_t pos_; uint32_t len_; const char *ptr_; }; }; #endif
cb2138af59d3ea09712a5774bb5a7bb0ac84cb12
0a8a0b80abb155fa74b0fd4746bf01e8d666a5d3
/polarity/PolarityGame/src/Editor/EditorInput.cpp
2cb66b845e735bac06546619f3e8c90c010d4b4a
[ "Unlicense" ]
permissive
doggan/code-dump
48e7cf0c39bc9a84fc3e91e423e248d17b5fb3d5
8f4c7bc32ea45ae0a775838e2a7f7217017cd1be
refs/heads/master
2022-01-11T19:13:17.942575
2021-12-29T08:25:01
2021-12-29T08:25:01
29,381,706
0
0
null
null
null
null
UTF-8
C++
false
false
1,507
cpp
EditorInput.cpp
#ifdef EDITOR #include "EditorInput.h" void EditorInput::update() { // if button is down, change it to HELD // if button is up, change it to INACTIVE // Mouse. { std::map<int, KEY_STATE>::iterator iter; for(iter = m_buttonStates.begin(); iter != m_buttonStates.end(); ++iter) { // From down to held. if (iter->second == KEY_DOWN) { iter->second = KEY_HELD; } // From up to inactive. else if (iter->second == KEY_UP) { iter->second = KEY_INACTIVE; } } } // Keyboard. { std::map<int, KEY_STATE>::iterator iter; for(iter = m_keyStates.begin(); iter != m_keyStates.end(); ++iter) { // From down to held. if (iter->second == KEY_DOWN) { iter->second = KEY_HELD; } // From up to inactive. else if (iter->second == KEY_UP) { iter->second = KEY_INACTIVE; } } } } void EditorInput::update(int key, KEY_STATE state) { // Avoid overwriting a currently KEY_HELD with a KEY_DOWN, so // we can decern the difference. wxWidgets fires the same // event regardless, but we want to know the difference! if (state == KEY_DOWN && m_keyStates.find(key) != m_keyStates.end()) { if (m_keyStates[key] == KEY_HELD) return; } m_keyStates[key] = state; } void EditorInput::update(int button, KEY_STATE state, vec2<uint> pos) { m_buttonStates[button] = state; m_mousePos = pos; } void EditorInput::update(vec2<uint> pos) { m_mousePos = pos; } #endif
7cee81984a02403355f4ca8d3c359a1906f8c092
34faf51d9af99c9c2a1115a0ec37f77305aa2aa2
/cisco-ios-xe/ydk/models/cisco_ios_xe/fragmented/Cisco_IOS_XE_native_127.cpp
e14d74d09744d37c42a7028a5f64b023783b862b
[ "Apache-2.0" ]
permissive
shawvi/ydk-cpp
98fe0ed47413f08e6ce8fd5b6a0393ff0da6c5d5
58199aa5b8d2b73c452955ef3eb93d6d3720223e
refs/heads/master
2020-04-27T10:37:25.141296
2019-02-13T00:01:42
2019-02-13T00:01:42
null
0
0
null
null
null
null
UTF-8
C++
false
false
558,550
cpp
Cisco_IOS_XE_native_127.cpp
#include <sstream> #include <iostream> #include <ydk/entity_util.hpp> #include "bundle_info.hpp" #include "generated_entity_lookup.hpp" #include "Cisco_IOS_XE_native_127.hpp" #include "Cisco_IOS_XE_native_128.hpp" using namespace ydk; namespace cisco_ios_xe { namespace Cisco_IOS_XE_native { Native::Crypto::Key::Encrypt::Write::Ec::Ec() : name{YType::str, "name"}, passphrase{YType::str, "passphrase"} { yang_name = "ec"; yang_parent_name = "write"; is_top_level_class = false; has_list_ancestor = false; is_presence_container = true; } Native::Crypto::Key::Encrypt::Write::Ec::~Ec() { } bool Native::Crypto::Key::Encrypt::Write::Ec::has_data() const { if (is_presence_container) return true; return name.is_set || passphrase.is_set; } bool Native::Crypto::Key::Encrypt::Write::Ec::has_operation() const { return is_set(yfilter) || ydk::is_set(name.yfilter) || ydk::is_set(passphrase.yfilter); } std::string Native::Crypto::Key::Encrypt::Write::Ec::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:key/encrypt/write/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Key::Encrypt::Write::Ec::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ec"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::Encrypt::Write::Ec::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (name.is_set || is_set(name.yfilter)) leaf_name_data.push_back(name.get_name_leafdata()); if (passphrase.is_set || is_set(passphrase.yfilter)) leaf_name_data.push_back(passphrase.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::Encrypt::Write::Ec::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::Encrypt::Write::Ec::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Key::Encrypt::Write::Ec::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "name") { name = value; name.value_namespace = name_space; name.value_namespace_prefix = name_space_prefix; } if(value_path == "passphrase") { passphrase = value; passphrase.value_namespace = name_space; passphrase.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Key::Encrypt::Write::Ec::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "name") { name.yfilter = yfilter; } if(value_path == "passphrase") { passphrase.yfilter = yfilter; } } bool Native::Crypto::Key::Encrypt::Write::Ec::has_leaf_or_child_of_name(const std::string & name) const { if(name == "name" || name == "passphrase") return true; return false; } Native::Crypto::Key::Encrypt::Write::Rsa::Rsa() : name{YType::str, "name"}, passphrase{YType::str, "passphrase"} { yang_name = "rsa"; yang_parent_name = "write"; is_top_level_class = false; has_list_ancestor = false; is_presence_container = true; } Native::Crypto::Key::Encrypt::Write::Rsa::~Rsa() { } bool Native::Crypto::Key::Encrypt::Write::Rsa::has_data() const { if (is_presence_container) return true; return name.is_set || passphrase.is_set; } bool Native::Crypto::Key::Encrypt::Write::Rsa::has_operation() const { return is_set(yfilter) || ydk::is_set(name.yfilter) || ydk::is_set(passphrase.yfilter); } std::string Native::Crypto::Key::Encrypt::Write::Rsa::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:key/encrypt/write/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Key::Encrypt::Write::Rsa::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "rsa"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::Encrypt::Write::Rsa::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (name.is_set || is_set(name.yfilter)) leaf_name_data.push_back(name.get_name_leafdata()); if (passphrase.is_set || is_set(passphrase.yfilter)) leaf_name_data.push_back(passphrase.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::Encrypt::Write::Rsa::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::Encrypt::Write::Rsa::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Key::Encrypt::Write::Rsa::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "name") { name = value; name.value_namespace = name_space; name.value_namespace_prefix = name_space_prefix; } if(value_path == "passphrase") { passphrase = value; passphrase.value_namespace = name_space; passphrase.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Key::Encrypt::Write::Rsa::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "name") { name.yfilter = yfilter; } if(value_path == "passphrase") { passphrase.yfilter = yfilter; } } bool Native::Crypto::Key::Encrypt::Write::Rsa::has_leaf_or_child_of_name(const std::string & name) const { if(name == "name" || name == "passphrase") return true; return false; } Native::Crypto::Key::Export::Export() : ec(this, {"label"}) , rsa(this, {"label"}) { yang_name = "export"; yang_parent_name = "key"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Key::Export::~Export() { } bool Native::Crypto::Key::Export::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<ec.len(); index++) { if(ec[index]->has_data()) return true; } for (std::size_t index=0; index<rsa.len(); index++) { if(rsa[index]->has_data()) return true; } return false; } bool Native::Crypto::Key::Export::has_operation() const { for (std::size_t index=0; index<ec.len(); index++) { if(ec[index]->has_operation()) return true; } for (std::size_t index=0; index<rsa.len(); index++) { if(rsa[index]->has_operation()) return true; } return is_set(yfilter); } std::string Native::Crypto::Key::Export::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:key/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Key::Export::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "export"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::Export::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::Export::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "ec") { auto ent_ = std::make_shared<Native::Crypto::Key::Export::Ec>(); ent_->parent = this; ec.append(ent_); return ent_; } if(child_yang_name == "rsa") { auto ent_ = std::make_shared<Native::Crypto::Key::Export::Rsa>(); ent_->parent = this; rsa.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::Export::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : ec.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } count_ = 0; for (auto ent_ : rsa.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void Native::Crypto::Key::Export::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Key::Export::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Key::Export::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ec" || name == "rsa") return true; return false; } Native::Crypto::Key::Export::Ec::Ec() : label{YType::str, "label"} , pem(std::make_shared<Native::Crypto::Key::Export::Ec::Pem>()) { pem->parent = this; yang_name = "ec"; yang_parent_name = "export"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Key::Export::Ec::~Ec() { } bool Native::Crypto::Key::Export::Ec::has_data() const { if (is_presence_container) return true; return label.is_set || (pem != nullptr && pem->has_data()); } bool Native::Crypto::Key::Export::Ec::has_operation() const { return is_set(yfilter) || ydk::is_set(label.yfilter) || (pem != nullptr && pem->has_operation()); } std::string Native::Crypto::Key::Export::Ec::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:key/export/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Key::Export::Ec::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ec"; ADD_KEY_TOKEN(label, "label"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::Export::Ec::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (label.is_set || is_set(label.yfilter)) leaf_name_data.push_back(label.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::Export::Ec::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "pem") { if(pem == nullptr) { pem = std::make_shared<Native::Crypto::Key::Export::Ec::Pem>(); } return pem; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::Export::Ec::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(pem != nullptr) { _children["pem"] = pem; } return _children; } void Native::Crypto::Key::Export::Ec::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "label") { label = value; label.value_namespace = name_space; label.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Key::Export::Ec::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "label") { label.yfilter = yfilter; } } bool Native::Crypto::Key::Export::Ec::has_leaf_or_child_of_name(const std::string & name) const { if(name == "pem" || name == "label") return true; return false; } Native::Crypto::Key::Export::Ec::Pem::Pem() : terminal(std::make_shared<Native::Crypto::Key::Export::Ec::Pem::Terminal>()) , url(std::make_shared<Native::Crypto::Key::Export::Ec::Pem::Url>()) { terminal->parent = this; url->parent = this; yang_name = "pem"; yang_parent_name = "ec"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Key::Export::Ec::Pem::~Pem() { } bool Native::Crypto::Key::Export::Ec::Pem::has_data() const { if (is_presence_container) return true; return (terminal != nullptr && terminal->has_data()) || (url != nullptr && url->has_data()); } bool Native::Crypto::Key::Export::Ec::Pem::has_operation() const { return is_set(yfilter) || (terminal != nullptr && terminal->has_operation()) || (url != nullptr && url->has_operation()); } std::string Native::Crypto::Key::Export::Ec::Pem::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "pem"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::Export::Ec::Pem::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::Export::Ec::Pem::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "terminal") { if(terminal == nullptr) { terminal = std::make_shared<Native::Crypto::Key::Export::Ec::Pem::Terminal>(); } return terminal; } if(child_yang_name == "url") { if(url == nullptr) { url = std::make_shared<Native::Crypto::Key::Export::Ec::Pem::Url>(); } return url; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::Export::Ec::Pem::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(terminal != nullptr) { _children["terminal"] = terminal; } if(url != nullptr) { _children["url"] = url; } return _children; } void Native::Crypto::Key::Export::Ec::Pem::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Key::Export::Ec::Pem::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Key::Export::Ec::Pem::has_leaf_or_child_of_name(const std::string & name) const { if(name == "terminal" || name == "url") return true; return false; } Native::Crypto::Key::Export::Ec::Pem::Terminal::Terminal() : pk_3des{YType::str, "pk-3des"}, des{YType::str, "des"} { yang_name = "terminal"; yang_parent_name = "pem"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Key::Export::Ec::Pem::Terminal::~Terminal() { } bool Native::Crypto::Key::Export::Ec::Pem::Terminal::has_data() const { if (is_presence_container) return true; return pk_3des.is_set || des.is_set; } bool Native::Crypto::Key::Export::Ec::Pem::Terminal::has_operation() const { return is_set(yfilter) || ydk::is_set(pk_3des.yfilter) || ydk::is_set(des.yfilter); } std::string Native::Crypto::Key::Export::Ec::Pem::Terminal::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "terminal"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::Export::Ec::Pem::Terminal::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (pk_3des.is_set || is_set(pk_3des.yfilter)) leaf_name_data.push_back(pk_3des.get_name_leafdata()); if (des.is_set || is_set(des.yfilter)) leaf_name_data.push_back(des.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::Export::Ec::Pem::Terminal::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::Export::Ec::Pem::Terminal::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Key::Export::Ec::Pem::Terminal::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "pk-3des") { pk_3des = value; pk_3des.value_namespace = name_space; pk_3des.value_namespace_prefix = name_space_prefix; } if(value_path == "des") { des = value; des.value_namespace = name_space; des.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Key::Export::Ec::Pem::Terminal::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "pk-3des") { pk_3des.yfilter = yfilter; } if(value_path == "des") { des.yfilter = yfilter; } } bool Native::Crypto::Key::Export::Ec::Pem::Terminal::has_leaf_or_child_of_name(const std::string & name) const { if(name == "pk-3des" || name == "des") return true; return false; } Native::Crypto::Key::Export::Ec::Pem::Url::Url() : file{YType::enumeration, "file"}, url_3des{YType::str, "url-3des"}, des{YType::str, "des"} { yang_name = "url"; yang_parent_name = "pem"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Key::Export::Ec::Pem::Url::~Url() { } bool Native::Crypto::Key::Export::Ec::Pem::Url::has_data() const { if (is_presence_container) return true; return file.is_set || url_3des.is_set || des.is_set; } bool Native::Crypto::Key::Export::Ec::Pem::Url::has_operation() const { return is_set(yfilter) || ydk::is_set(file.yfilter) || ydk::is_set(url_3des.yfilter) || ydk::is_set(des.yfilter); } std::string Native::Crypto::Key::Export::Ec::Pem::Url::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "url"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::Export::Ec::Pem::Url::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (file.is_set || is_set(file.yfilter)) leaf_name_data.push_back(file.get_name_leafdata()); if (url_3des.is_set || is_set(url_3des.yfilter)) leaf_name_data.push_back(url_3des.get_name_leafdata()); if (des.is_set || is_set(des.yfilter)) leaf_name_data.push_back(des.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::Export::Ec::Pem::Url::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::Export::Ec::Pem::Url::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Key::Export::Ec::Pem::Url::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "file") { file = value; file.value_namespace = name_space; file.value_namespace_prefix = name_space_prefix; } if(value_path == "url-3des") { url_3des = value; url_3des.value_namespace = name_space; url_3des.value_namespace_prefix = name_space_prefix; } if(value_path == "des") { des = value; des.value_namespace = name_space; des.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Key::Export::Ec::Pem::Url::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "file") { file.yfilter = yfilter; } if(value_path == "url-3des") { url_3des.yfilter = yfilter; } if(value_path == "des") { des.yfilter = yfilter; } } bool Native::Crypto::Key::Export::Ec::Pem::Url::has_leaf_or_child_of_name(const std::string & name) const { if(name == "file" || name == "url-3des" || name == "des") return true; return false; } Native::Crypto::Key::Export::Rsa::Rsa() : label{YType::str, "label"} , pem(std::make_shared<Native::Crypto::Key::Export::Rsa::Pem>()) { pem->parent = this; yang_name = "rsa"; yang_parent_name = "export"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Key::Export::Rsa::~Rsa() { } bool Native::Crypto::Key::Export::Rsa::has_data() const { if (is_presence_container) return true; return label.is_set || (pem != nullptr && pem->has_data()); } bool Native::Crypto::Key::Export::Rsa::has_operation() const { return is_set(yfilter) || ydk::is_set(label.yfilter) || (pem != nullptr && pem->has_operation()); } std::string Native::Crypto::Key::Export::Rsa::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:key/export/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Key::Export::Rsa::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "rsa"; ADD_KEY_TOKEN(label, "label"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::Export::Rsa::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (label.is_set || is_set(label.yfilter)) leaf_name_data.push_back(label.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::Export::Rsa::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "pem") { if(pem == nullptr) { pem = std::make_shared<Native::Crypto::Key::Export::Rsa::Pem>(); } return pem; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::Export::Rsa::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(pem != nullptr) { _children["pem"] = pem; } return _children; } void Native::Crypto::Key::Export::Rsa::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "label") { label = value; label.value_namespace = name_space; label.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Key::Export::Rsa::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "label") { label.yfilter = yfilter; } } bool Native::Crypto::Key::Export::Rsa::has_leaf_or_child_of_name(const std::string & name) const { if(name == "pem" || name == "label") return true; return false; } Native::Crypto::Key::Export::Rsa::Pem::Pem() : terminal(std::make_shared<Native::Crypto::Key::Export::Rsa::Pem::Terminal>()) , url(std::make_shared<Native::Crypto::Key::Export::Rsa::Pem::Url>()) { terminal->parent = this; url->parent = this; yang_name = "pem"; yang_parent_name = "rsa"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Key::Export::Rsa::Pem::~Pem() { } bool Native::Crypto::Key::Export::Rsa::Pem::has_data() const { if (is_presence_container) return true; return (terminal != nullptr && terminal->has_data()) || (url != nullptr && url->has_data()); } bool Native::Crypto::Key::Export::Rsa::Pem::has_operation() const { return is_set(yfilter) || (terminal != nullptr && terminal->has_operation()) || (url != nullptr && url->has_operation()); } std::string Native::Crypto::Key::Export::Rsa::Pem::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "pem"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::Export::Rsa::Pem::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::Export::Rsa::Pem::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "terminal") { if(terminal == nullptr) { terminal = std::make_shared<Native::Crypto::Key::Export::Rsa::Pem::Terminal>(); } return terminal; } if(child_yang_name == "url") { if(url == nullptr) { url = std::make_shared<Native::Crypto::Key::Export::Rsa::Pem::Url>(); } return url; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::Export::Rsa::Pem::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(terminal != nullptr) { _children["terminal"] = terminal; } if(url != nullptr) { _children["url"] = url; } return _children; } void Native::Crypto::Key::Export::Rsa::Pem::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Key::Export::Rsa::Pem::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Key::Export::Rsa::Pem::has_leaf_or_child_of_name(const std::string & name) const { if(name == "terminal" || name == "url") return true; return false; } Native::Crypto::Key::Export::Rsa::Pem::Terminal::Terminal() : pk_3des{YType::str, "pk-3des"}, des{YType::str, "des"} { yang_name = "terminal"; yang_parent_name = "pem"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Key::Export::Rsa::Pem::Terminal::~Terminal() { } bool Native::Crypto::Key::Export::Rsa::Pem::Terminal::has_data() const { if (is_presence_container) return true; return pk_3des.is_set || des.is_set; } bool Native::Crypto::Key::Export::Rsa::Pem::Terminal::has_operation() const { return is_set(yfilter) || ydk::is_set(pk_3des.yfilter) || ydk::is_set(des.yfilter); } std::string Native::Crypto::Key::Export::Rsa::Pem::Terminal::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "terminal"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::Export::Rsa::Pem::Terminal::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (pk_3des.is_set || is_set(pk_3des.yfilter)) leaf_name_data.push_back(pk_3des.get_name_leafdata()); if (des.is_set || is_set(des.yfilter)) leaf_name_data.push_back(des.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::Export::Rsa::Pem::Terminal::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::Export::Rsa::Pem::Terminal::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Key::Export::Rsa::Pem::Terminal::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "pk-3des") { pk_3des = value; pk_3des.value_namespace = name_space; pk_3des.value_namespace_prefix = name_space_prefix; } if(value_path == "des") { des = value; des.value_namespace = name_space; des.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Key::Export::Rsa::Pem::Terminal::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "pk-3des") { pk_3des.yfilter = yfilter; } if(value_path == "des") { des.yfilter = yfilter; } } bool Native::Crypto::Key::Export::Rsa::Pem::Terminal::has_leaf_or_child_of_name(const std::string & name) const { if(name == "pk-3des" || name == "des") return true; return false; } Native::Crypto::Key::Export::Rsa::Pem::Url::Url() : file{YType::enumeration, "file"}, url_3des{YType::str, "url-3des"}, des{YType::str, "des"} { yang_name = "url"; yang_parent_name = "pem"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Key::Export::Rsa::Pem::Url::~Url() { } bool Native::Crypto::Key::Export::Rsa::Pem::Url::has_data() const { if (is_presence_container) return true; return file.is_set || url_3des.is_set || des.is_set; } bool Native::Crypto::Key::Export::Rsa::Pem::Url::has_operation() const { return is_set(yfilter) || ydk::is_set(file.yfilter) || ydk::is_set(url_3des.yfilter) || ydk::is_set(des.yfilter); } std::string Native::Crypto::Key::Export::Rsa::Pem::Url::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "url"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::Export::Rsa::Pem::Url::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (file.is_set || is_set(file.yfilter)) leaf_name_data.push_back(file.get_name_leafdata()); if (url_3des.is_set || is_set(url_3des.yfilter)) leaf_name_data.push_back(url_3des.get_name_leafdata()); if (des.is_set || is_set(des.yfilter)) leaf_name_data.push_back(des.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::Export::Rsa::Pem::Url::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::Export::Rsa::Pem::Url::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Key::Export::Rsa::Pem::Url::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "file") { file = value; file.value_namespace = name_space; file.value_namespace_prefix = name_space_prefix; } if(value_path == "url-3des") { url_3des = value; url_3des.value_namespace = name_space; url_3des.value_namespace_prefix = name_space_prefix; } if(value_path == "des") { des = value; des.value_namespace = name_space; des.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Key::Export::Rsa::Pem::Url::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "file") { file.yfilter = yfilter; } if(value_path == "url-3des") { url_3des.yfilter = yfilter; } if(value_path == "des") { des.yfilter = yfilter; } } bool Native::Crypto::Key::Export::Rsa::Pem::Url::has_leaf_or_child_of_name(const std::string & name) const { if(name == "file" || name == "url-3des" || name == "des") return true; return false; } Native::Crypto::Key::Generate::Generate() : ec(std::make_shared<Native::Crypto::Key::Generate::Ec>()) , rsa(nullptr) // presence node { ec->parent = this; yang_name = "generate"; yang_parent_name = "key"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Key::Generate::~Generate() { } bool Native::Crypto::Key::Generate::has_data() const { if (is_presence_container) return true; return (ec != nullptr && ec->has_data()) || (rsa != nullptr && rsa->has_data()); } bool Native::Crypto::Key::Generate::has_operation() const { return is_set(yfilter) || (ec != nullptr && ec->has_operation()) || (rsa != nullptr && rsa->has_operation()); } std::string Native::Crypto::Key::Generate::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:key/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Key::Generate::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "generate"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::Generate::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::Generate::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "ec") { if(ec == nullptr) { ec = std::make_shared<Native::Crypto::Key::Generate::Ec>(); } return ec; } if(child_yang_name == "rsa") { if(rsa == nullptr) { rsa = std::make_shared<Native::Crypto::Key::Generate::Rsa>(); } return rsa; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::Generate::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(ec != nullptr) { _children["ec"] = ec; } if(rsa != nullptr) { _children["rsa"] = rsa; } return _children; } void Native::Crypto::Key::Generate::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Key::Generate::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Key::Generate::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ec" || name == "rsa") return true; return false; } Native::Crypto::Key::Generate::Ec::Ec() : keysize{YType::enumeration, "keysize"}, exportable{YType::empty, "exportable"}, label{YType::str, "label"} { yang_name = "ec"; yang_parent_name = "generate"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Key::Generate::Ec::~Ec() { } bool Native::Crypto::Key::Generate::Ec::has_data() const { if (is_presence_container) return true; return keysize.is_set || exportable.is_set || label.is_set; } bool Native::Crypto::Key::Generate::Ec::has_operation() const { return is_set(yfilter) || ydk::is_set(keysize.yfilter) || ydk::is_set(exportable.yfilter) || ydk::is_set(label.yfilter); } std::string Native::Crypto::Key::Generate::Ec::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:key/generate/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Key::Generate::Ec::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ec"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::Generate::Ec::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (keysize.is_set || is_set(keysize.yfilter)) leaf_name_data.push_back(keysize.get_name_leafdata()); if (exportable.is_set || is_set(exportable.yfilter)) leaf_name_data.push_back(exportable.get_name_leafdata()); if (label.is_set || is_set(label.yfilter)) leaf_name_data.push_back(label.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::Generate::Ec::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::Generate::Ec::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Key::Generate::Ec::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "keysize") { keysize = value; keysize.value_namespace = name_space; keysize.value_namespace_prefix = name_space_prefix; } if(value_path == "exportable") { exportable = value; exportable.value_namespace = name_space; exportable.value_namespace_prefix = name_space_prefix; } if(value_path == "label") { label = value; label.value_namespace = name_space; label.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Key::Generate::Ec::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "keysize") { keysize.yfilter = yfilter; } if(value_path == "exportable") { exportable.yfilter = yfilter; } if(value_path == "label") { label.yfilter = yfilter; } } bool Native::Crypto::Key::Generate::Ec::has_leaf_or_child_of_name(const std::string & name) const { if(name == "keysize" || name == "exportable" || name == "label") return true; return false; } Native::Crypto::Key::Generate::Rsa::Rsa() : encryption{YType::empty, "encryption"}, exportable{YType::empty, "exportable"}, general_keys{YType::empty, "general-keys"}, label{YType::str, "label"}, modulus{YType::uint16, "modulus"}, on{YType::str, "on"}, redundancy{YType::empty, "redundancy"}, signature{YType::empty, "signature"}, storage{YType::str, "storage"}, usage_keys{YType::empty, "usage-keys"} { yang_name = "rsa"; yang_parent_name = "generate"; is_top_level_class = false; has_list_ancestor = false; is_presence_container = true; } Native::Crypto::Key::Generate::Rsa::~Rsa() { } bool Native::Crypto::Key::Generate::Rsa::has_data() const { if (is_presence_container) return true; return encryption.is_set || exportable.is_set || general_keys.is_set || label.is_set || modulus.is_set || on.is_set || redundancy.is_set || signature.is_set || storage.is_set || usage_keys.is_set; } bool Native::Crypto::Key::Generate::Rsa::has_operation() const { return is_set(yfilter) || ydk::is_set(encryption.yfilter) || ydk::is_set(exportable.yfilter) || ydk::is_set(general_keys.yfilter) || ydk::is_set(label.yfilter) || ydk::is_set(modulus.yfilter) || ydk::is_set(on.yfilter) || ydk::is_set(redundancy.yfilter) || ydk::is_set(signature.yfilter) || ydk::is_set(storage.yfilter) || ydk::is_set(usage_keys.yfilter); } std::string Native::Crypto::Key::Generate::Rsa::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:key/generate/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Key::Generate::Rsa::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "rsa"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::Generate::Rsa::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (encryption.is_set || is_set(encryption.yfilter)) leaf_name_data.push_back(encryption.get_name_leafdata()); if (exportable.is_set || is_set(exportable.yfilter)) leaf_name_data.push_back(exportable.get_name_leafdata()); if (general_keys.is_set || is_set(general_keys.yfilter)) leaf_name_data.push_back(general_keys.get_name_leafdata()); if (label.is_set || is_set(label.yfilter)) leaf_name_data.push_back(label.get_name_leafdata()); if (modulus.is_set || is_set(modulus.yfilter)) leaf_name_data.push_back(modulus.get_name_leafdata()); if (on.is_set || is_set(on.yfilter)) leaf_name_data.push_back(on.get_name_leafdata()); if (redundancy.is_set || is_set(redundancy.yfilter)) leaf_name_data.push_back(redundancy.get_name_leafdata()); if (signature.is_set || is_set(signature.yfilter)) leaf_name_data.push_back(signature.get_name_leafdata()); if (storage.is_set || is_set(storage.yfilter)) leaf_name_data.push_back(storage.get_name_leafdata()); if (usage_keys.is_set || is_set(usage_keys.yfilter)) leaf_name_data.push_back(usage_keys.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::Generate::Rsa::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::Generate::Rsa::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Key::Generate::Rsa::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "encryption") { encryption = value; encryption.value_namespace = name_space; encryption.value_namespace_prefix = name_space_prefix; } if(value_path == "exportable") { exportable = value; exportable.value_namespace = name_space; exportable.value_namespace_prefix = name_space_prefix; } if(value_path == "general-keys") { general_keys = value; general_keys.value_namespace = name_space; general_keys.value_namespace_prefix = name_space_prefix; } if(value_path == "label") { label = value; label.value_namespace = name_space; label.value_namespace_prefix = name_space_prefix; } if(value_path == "modulus") { modulus = value; modulus.value_namespace = name_space; modulus.value_namespace_prefix = name_space_prefix; } if(value_path == "on") { on = value; on.value_namespace = name_space; on.value_namespace_prefix = name_space_prefix; } if(value_path == "redundancy") { redundancy = value; redundancy.value_namespace = name_space; redundancy.value_namespace_prefix = name_space_prefix; } if(value_path == "signature") { signature = value; signature.value_namespace = name_space; signature.value_namespace_prefix = name_space_prefix; } if(value_path == "storage") { storage = value; storage.value_namespace = name_space; storage.value_namespace_prefix = name_space_prefix; } if(value_path == "usage-keys") { usage_keys = value; usage_keys.value_namespace = name_space; usage_keys.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Key::Generate::Rsa::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "encryption") { encryption.yfilter = yfilter; } if(value_path == "exportable") { exportable.yfilter = yfilter; } if(value_path == "general-keys") { general_keys.yfilter = yfilter; } if(value_path == "label") { label.yfilter = yfilter; } if(value_path == "modulus") { modulus.yfilter = yfilter; } if(value_path == "on") { on.yfilter = yfilter; } if(value_path == "redundancy") { redundancy.yfilter = yfilter; } if(value_path == "signature") { signature.yfilter = yfilter; } if(value_path == "storage") { storage.yfilter = yfilter; } if(value_path == "usage-keys") { usage_keys.yfilter = yfilter; } } bool Native::Crypto::Key::Generate::Rsa::has_leaf_or_child_of_name(const std::string & name) const { if(name == "encryption" || name == "exportable" || name == "general-keys" || name == "label" || name == "modulus" || name == "on" || name == "redundancy" || name == "signature" || name == "storage" || name == "usage-keys") return true; return false; } Native::Crypto::Key::Import::Import() : ec(this, {"name"}) , rsa(this, {"label"}) { yang_name = "import"; yang_parent_name = "key"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Key::Import::~Import() { } bool Native::Crypto::Key::Import::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<ec.len(); index++) { if(ec[index]->has_data()) return true; } for (std::size_t index=0; index<rsa.len(); index++) { if(rsa[index]->has_data()) return true; } return false; } bool Native::Crypto::Key::Import::has_operation() const { for (std::size_t index=0; index<ec.len(); index++) { if(ec[index]->has_operation()) return true; } for (std::size_t index=0; index<rsa.len(); index++) { if(rsa[index]->has_operation()) return true; } return is_set(yfilter); } std::string Native::Crypto::Key::Import::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:key/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Key::Import::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "import"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::Import::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::Import::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "ec") { auto ent_ = std::make_shared<Native::Crypto::Key::Import::Ec>(); ent_->parent = this; ec.append(ent_); return ent_; } if(child_yang_name == "rsa") { auto ent_ = std::make_shared<Native::Crypto::Key::Import::Rsa>(); ent_->parent = this; rsa.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::Import::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : ec.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } count_ = 0; for (auto ent_ : rsa.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void Native::Crypto::Key::Import::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Key::Import::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Key::Import::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ec" || name == "rsa") return true; return false; } Native::Crypto::Key::Import::Ec::Ec() : name{YType::str, "name"}, exportable{YType::empty, "exportable"}, terminal{YType::str, "terminal"} , url(std::make_shared<Native::Crypto::Key::Import::Ec::Url>()) { url->parent = this; yang_name = "ec"; yang_parent_name = "import"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Key::Import::Ec::~Ec() { } bool Native::Crypto::Key::Import::Ec::has_data() const { if (is_presence_container) return true; return name.is_set || exportable.is_set || terminal.is_set || (url != nullptr && url->has_data()); } bool Native::Crypto::Key::Import::Ec::has_operation() const { return is_set(yfilter) || ydk::is_set(name.yfilter) || ydk::is_set(exportable.yfilter) || ydk::is_set(terminal.yfilter) || (url != nullptr && url->has_operation()); } std::string Native::Crypto::Key::Import::Ec::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:key/import/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Key::Import::Ec::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ec"; ADD_KEY_TOKEN(name, "name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::Import::Ec::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (name.is_set || is_set(name.yfilter)) leaf_name_data.push_back(name.get_name_leafdata()); if (exportable.is_set || is_set(exportable.yfilter)) leaf_name_data.push_back(exportable.get_name_leafdata()); if (terminal.is_set || is_set(terminal.yfilter)) leaf_name_data.push_back(terminal.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::Import::Ec::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "url") { if(url == nullptr) { url = std::make_shared<Native::Crypto::Key::Import::Ec::Url>(); } return url; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::Import::Ec::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(url != nullptr) { _children["url"] = url; } return _children; } void Native::Crypto::Key::Import::Ec::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "name") { name = value; name.value_namespace = name_space; name.value_namespace_prefix = name_space_prefix; } if(value_path == "exportable") { exportable = value; exportable.value_namespace = name_space; exportable.value_namespace_prefix = name_space_prefix; } if(value_path == "terminal") { terminal = value; terminal.value_namespace = name_space; terminal.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Key::Import::Ec::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "name") { name.yfilter = yfilter; } if(value_path == "exportable") { exportable.yfilter = yfilter; } if(value_path == "terminal") { terminal.yfilter = yfilter; } } bool Native::Crypto::Key::Import::Ec::has_leaf_or_child_of_name(const std::string & name) const { if(name == "url" || name == "name" || name == "exportable" || name == "terminal") return true; return false; } Native::Crypto::Key::Import::Ec::Url::Url() : file{YType::enumeration, "file"}, key{YType::str, "key"} { yang_name = "url"; yang_parent_name = "ec"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Key::Import::Ec::Url::~Url() { } bool Native::Crypto::Key::Import::Ec::Url::has_data() const { if (is_presence_container) return true; return file.is_set || key.is_set; } bool Native::Crypto::Key::Import::Ec::Url::has_operation() const { return is_set(yfilter) || ydk::is_set(file.yfilter) || ydk::is_set(key.yfilter); } std::string Native::Crypto::Key::Import::Ec::Url::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "url"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::Import::Ec::Url::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (file.is_set || is_set(file.yfilter)) leaf_name_data.push_back(file.get_name_leafdata()); if (key.is_set || is_set(key.yfilter)) leaf_name_data.push_back(key.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::Import::Ec::Url::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::Import::Ec::Url::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Key::Import::Ec::Url::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "file") { file = value; file.value_namespace = name_space; file.value_namespace_prefix = name_space_prefix; } if(value_path == "key") { key = value; key.value_namespace = name_space; key.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Key::Import::Ec::Url::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "file") { file.yfilter = yfilter; } if(value_path == "key") { key.yfilter = yfilter; } } bool Native::Crypto::Key::Import::Ec::Url::has_leaf_or_child_of_name(const std::string & name) const { if(name == "file" || name == "key") return true; return false; } Native::Crypto::Key::Import::Rsa::Rsa() : label{YType::str, "label"}, encryption{YType::empty, "encryption"}, exportable{YType::empty, "exportable"}, general_purpose{YType::empty, "general-purpose"}, on{YType::str, "on"}, pem{YType::empty, "pem"}, redundancy{YType::empty, "redundancy"}, signature{YType::empty, "signature"}, storage{YType::str, "storage"}, usage_keys{YType::empty, "usage-keys"}, terminal{YType::str, "terminal"} , url(std::make_shared<Native::Crypto::Key::Import::Rsa::Url>()) { url->parent = this; yang_name = "rsa"; yang_parent_name = "import"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Key::Import::Rsa::~Rsa() { } bool Native::Crypto::Key::Import::Rsa::has_data() const { if (is_presence_container) return true; return label.is_set || encryption.is_set || exportable.is_set || general_purpose.is_set || on.is_set || pem.is_set || redundancy.is_set || signature.is_set || storage.is_set || usage_keys.is_set || terminal.is_set || (url != nullptr && url->has_data()); } bool Native::Crypto::Key::Import::Rsa::has_operation() const { return is_set(yfilter) || ydk::is_set(label.yfilter) || ydk::is_set(encryption.yfilter) || ydk::is_set(exportable.yfilter) || ydk::is_set(general_purpose.yfilter) || ydk::is_set(on.yfilter) || ydk::is_set(pem.yfilter) || ydk::is_set(redundancy.yfilter) || ydk::is_set(signature.yfilter) || ydk::is_set(storage.yfilter) || ydk::is_set(usage_keys.yfilter) || ydk::is_set(terminal.yfilter) || (url != nullptr && url->has_operation()); } std::string Native::Crypto::Key::Import::Rsa::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:key/import/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Key::Import::Rsa::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "rsa"; ADD_KEY_TOKEN(label, "label"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::Import::Rsa::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (label.is_set || is_set(label.yfilter)) leaf_name_data.push_back(label.get_name_leafdata()); if (encryption.is_set || is_set(encryption.yfilter)) leaf_name_data.push_back(encryption.get_name_leafdata()); if (exportable.is_set || is_set(exportable.yfilter)) leaf_name_data.push_back(exportable.get_name_leafdata()); if (general_purpose.is_set || is_set(general_purpose.yfilter)) leaf_name_data.push_back(general_purpose.get_name_leafdata()); if (on.is_set || is_set(on.yfilter)) leaf_name_data.push_back(on.get_name_leafdata()); if (pem.is_set || is_set(pem.yfilter)) leaf_name_data.push_back(pem.get_name_leafdata()); if (redundancy.is_set || is_set(redundancy.yfilter)) leaf_name_data.push_back(redundancy.get_name_leafdata()); if (signature.is_set || is_set(signature.yfilter)) leaf_name_data.push_back(signature.get_name_leafdata()); if (storage.is_set || is_set(storage.yfilter)) leaf_name_data.push_back(storage.get_name_leafdata()); if (usage_keys.is_set || is_set(usage_keys.yfilter)) leaf_name_data.push_back(usage_keys.get_name_leafdata()); if (terminal.is_set || is_set(terminal.yfilter)) leaf_name_data.push_back(terminal.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::Import::Rsa::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "url") { if(url == nullptr) { url = std::make_shared<Native::Crypto::Key::Import::Rsa::Url>(); } return url; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::Import::Rsa::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(url != nullptr) { _children["url"] = url; } return _children; } void Native::Crypto::Key::Import::Rsa::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "label") { label = value; label.value_namespace = name_space; label.value_namespace_prefix = name_space_prefix; } if(value_path == "encryption") { encryption = value; encryption.value_namespace = name_space; encryption.value_namespace_prefix = name_space_prefix; } if(value_path == "exportable") { exportable = value; exportable.value_namespace = name_space; exportable.value_namespace_prefix = name_space_prefix; } if(value_path == "general-purpose") { general_purpose = value; general_purpose.value_namespace = name_space; general_purpose.value_namespace_prefix = name_space_prefix; } if(value_path == "on") { on = value; on.value_namespace = name_space; on.value_namespace_prefix = name_space_prefix; } if(value_path == "pem") { pem = value; pem.value_namespace = name_space; pem.value_namespace_prefix = name_space_prefix; } if(value_path == "redundancy") { redundancy = value; redundancy.value_namespace = name_space; redundancy.value_namespace_prefix = name_space_prefix; } if(value_path == "signature") { signature = value; signature.value_namespace = name_space; signature.value_namespace_prefix = name_space_prefix; } if(value_path == "storage") { storage = value; storage.value_namespace = name_space; storage.value_namespace_prefix = name_space_prefix; } if(value_path == "usage-keys") { usage_keys = value; usage_keys.value_namespace = name_space; usage_keys.value_namespace_prefix = name_space_prefix; } if(value_path == "terminal") { terminal = value; terminal.value_namespace = name_space; terminal.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Key::Import::Rsa::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "label") { label.yfilter = yfilter; } if(value_path == "encryption") { encryption.yfilter = yfilter; } if(value_path == "exportable") { exportable.yfilter = yfilter; } if(value_path == "general-purpose") { general_purpose.yfilter = yfilter; } if(value_path == "on") { on.yfilter = yfilter; } if(value_path == "pem") { pem.yfilter = yfilter; } if(value_path == "redundancy") { redundancy.yfilter = yfilter; } if(value_path == "signature") { signature.yfilter = yfilter; } if(value_path == "storage") { storage.yfilter = yfilter; } if(value_path == "usage-keys") { usage_keys.yfilter = yfilter; } if(value_path == "terminal") { terminal.yfilter = yfilter; } } bool Native::Crypto::Key::Import::Rsa::has_leaf_or_child_of_name(const std::string & name) const { if(name == "url" || name == "label" || name == "encryption" || name == "exportable" || name == "general-purpose" || name == "on" || name == "pem" || name == "redundancy" || name == "signature" || name == "storage" || name == "usage-keys" || name == "terminal") return true; return false; } Native::Crypto::Key::Import::Rsa::Url::Url() : file{YType::enumeration, "file"}, key{YType::str, "key"} { yang_name = "url"; yang_parent_name = "rsa"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Key::Import::Rsa::Url::~Url() { } bool Native::Crypto::Key::Import::Rsa::Url::has_data() const { if (is_presence_container) return true; return file.is_set || key.is_set; } bool Native::Crypto::Key::Import::Rsa::Url::has_operation() const { return is_set(yfilter) || ydk::is_set(file.yfilter) || ydk::is_set(key.yfilter); } std::string Native::Crypto::Key::Import::Rsa::Url::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "url"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::Import::Rsa::Url::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (file.is_set || is_set(file.yfilter)) leaf_name_data.push_back(file.get_name_leafdata()); if (key.is_set || is_set(key.yfilter)) leaf_name_data.push_back(key.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::Import::Rsa::Url::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::Import::Rsa::Url::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Key::Import::Rsa::Url::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "file") { file = value; file.value_namespace = name_space; file.value_namespace_prefix = name_space_prefix; } if(value_path == "key") { key = value; key.value_namespace = name_space; key.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Key::Import::Rsa::Url::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "file") { file.yfilter = yfilter; } if(value_path == "key") { key.yfilter = yfilter; } } bool Native::Crypto::Key::Import::Rsa::Url::has_leaf_or_child_of_name(const std::string & name) const { if(name == "file" || name == "key") return true; return false; } Native::Crypto::Key::Move::Move() : rsa(std::make_shared<Native::Crypto::Key::Move::Rsa>()) { rsa->parent = this; yang_name = "move"; yang_parent_name = "key"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Key::Move::~Move() { } bool Native::Crypto::Key::Move::has_data() const { if (is_presence_container) return true; return (rsa != nullptr && rsa->has_data()); } bool Native::Crypto::Key::Move::has_operation() const { return is_set(yfilter) || (rsa != nullptr && rsa->has_operation()); } std::string Native::Crypto::Key::Move::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:key/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Key::Move::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "move"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::Move::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::Move::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "rsa") { if(rsa == nullptr) { rsa = std::make_shared<Native::Crypto::Key::Move::Rsa>(); } return rsa; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::Move::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(rsa != nullptr) { _children["rsa"] = rsa; } return _children; } void Native::Crypto::Key::Move::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Key::Move::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Key::Move::has_leaf_or_child_of_name(const std::string & name) const { if(name == "rsa") return true; return false; } Native::Crypto::Key::Move::Rsa::Rsa() : label{YType::str, "label"}, non_exportable{YType::empty, "non-exportable"}, on{YType::str, "on"}, redundancy{YType::empty, "redundancy"}, storage{YType::str, "storage"} { yang_name = "rsa"; yang_parent_name = "move"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Key::Move::Rsa::~Rsa() { } bool Native::Crypto::Key::Move::Rsa::has_data() const { if (is_presence_container) return true; return label.is_set || non_exportable.is_set || on.is_set || redundancy.is_set || storage.is_set; } bool Native::Crypto::Key::Move::Rsa::has_operation() const { return is_set(yfilter) || ydk::is_set(label.yfilter) || ydk::is_set(non_exportable.yfilter) || ydk::is_set(on.yfilter) || ydk::is_set(redundancy.yfilter) || ydk::is_set(storage.yfilter); } std::string Native::Crypto::Key::Move::Rsa::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:key/move/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Key::Move::Rsa::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "rsa"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::Move::Rsa::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (label.is_set || is_set(label.yfilter)) leaf_name_data.push_back(label.get_name_leafdata()); if (non_exportable.is_set || is_set(non_exportable.yfilter)) leaf_name_data.push_back(non_exportable.get_name_leafdata()); if (on.is_set || is_set(on.yfilter)) leaf_name_data.push_back(on.get_name_leafdata()); if (redundancy.is_set || is_set(redundancy.yfilter)) leaf_name_data.push_back(redundancy.get_name_leafdata()); if (storage.is_set || is_set(storage.yfilter)) leaf_name_data.push_back(storage.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::Move::Rsa::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::Move::Rsa::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Key::Move::Rsa::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "label") { label = value; label.value_namespace = name_space; label.value_namespace_prefix = name_space_prefix; } if(value_path == "non-exportable") { non_exportable = value; non_exportable.value_namespace = name_space; non_exportable.value_namespace_prefix = name_space_prefix; } if(value_path == "on") { on = value; on.value_namespace = name_space; on.value_namespace_prefix = name_space_prefix; } if(value_path == "redundancy") { redundancy = value; redundancy.value_namespace = name_space; redundancy.value_namespace_prefix = name_space_prefix; } if(value_path == "storage") { storage = value; storage.value_namespace = name_space; storage.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Key::Move::Rsa::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "label") { label.yfilter = yfilter; } if(value_path == "non-exportable") { non_exportable.yfilter = yfilter; } if(value_path == "on") { on.yfilter = yfilter; } if(value_path == "redundancy") { redundancy.yfilter = yfilter; } if(value_path == "storage") { storage.yfilter = yfilter; } } bool Native::Crypto::Key::Move::Rsa::has_leaf_or_child_of_name(const std::string & name) const { if(name == "label" || name == "non-exportable" || name == "on" || name == "redundancy" || name == "storage") return true; return false; } Native::Crypto::Key::PubkeyChain::PubkeyChain() : rsa(std::make_shared<Native::Crypto::Key::PubkeyChain::Rsa>()) { rsa->parent = this; yang_name = "pubkey-chain"; yang_parent_name = "key"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Key::PubkeyChain::~PubkeyChain() { } bool Native::Crypto::Key::PubkeyChain::has_data() const { if (is_presence_container) return true; return (rsa != nullptr && rsa->has_data()); } bool Native::Crypto::Key::PubkeyChain::has_operation() const { return is_set(yfilter) || (rsa != nullptr && rsa->has_operation()); } std::string Native::Crypto::Key::PubkeyChain::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:key/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Key::PubkeyChain::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "pubkey-chain"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::PubkeyChain::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::PubkeyChain::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "rsa") { if(rsa == nullptr) { rsa = std::make_shared<Native::Crypto::Key::PubkeyChain::Rsa>(); } return rsa; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::PubkeyChain::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(rsa != nullptr) { _children["rsa"] = rsa; } return _children; } void Native::Crypto::Key::PubkeyChain::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Key::PubkeyChain::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Key::PubkeyChain::has_leaf_or_child_of_name(const std::string & name) const { if(name == "rsa") return true; return false; } Native::Crypto::Key::PubkeyChain::Rsa::Rsa() : addressed_key(this, {"ip"}) , named_key(this, {"name"}) , default_(std::make_shared<Native::Crypto::Key::PubkeyChain::Rsa::Default>()) { default_->parent = this; yang_name = "rsa"; yang_parent_name = "pubkey-chain"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Key::PubkeyChain::Rsa::~Rsa() { } bool Native::Crypto::Key::PubkeyChain::Rsa::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<addressed_key.len(); index++) { if(addressed_key[index]->has_data()) return true; } for (std::size_t index=0; index<named_key.len(); index++) { if(named_key[index]->has_data()) return true; } return (default_ != nullptr && default_->has_data()); } bool Native::Crypto::Key::PubkeyChain::Rsa::has_operation() const { for (std::size_t index=0; index<addressed_key.len(); index++) { if(addressed_key[index]->has_operation()) return true; } for (std::size_t index=0; index<named_key.len(); index++) { if(named_key[index]->has_operation()) return true; } return is_set(yfilter) || (default_ != nullptr && default_->has_operation()); } std::string Native::Crypto::Key::PubkeyChain::Rsa::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:key/pubkey-chain/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Key::PubkeyChain::Rsa::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "rsa"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::PubkeyChain::Rsa::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::PubkeyChain::Rsa::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "addressed-key") { auto ent_ = std::make_shared<Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey>(); ent_->parent = this; addressed_key.append(ent_); return ent_; } if(child_yang_name == "named-key") { auto ent_ = std::make_shared<Native::Crypto::Key::PubkeyChain::Rsa::NamedKey>(); ent_->parent = this; named_key.append(ent_); return ent_; } if(child_yang_name == "default") { if(default_ == nullptr) { default_ = std::make_shared<Native::Crypto::Key::PubkeyChain::Rsa::Default>(); } return default_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::PubkeyChain::Rsa::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : addressed_key.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } count_ = 0; for (auto ent_ : named_key.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } if(default_ != nullptr) { _children["default"] = default_; } return _children; } void Native::Crypto::Key::PubkeyChain::Rsa::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Key::PubkeyChain::Rsa::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Key::PubkeyChain::Rsa::has_leaf_or_child_of_name(const std::string & name) const { if(name == "addressed-key" || name == "named-key" || name == "default") return true; return false; } Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::AddressedKey() : ip{YType::str, "ip"}, use{YType::enumeration, "use"}, address{YType::str, "address"}, serial_number{YType::str, "serial-number"} , key_string(std::make_shared<Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::KeyString>()) , default_(std::make_shared<Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::Default>()) { key_string->parent = this; default_->parent = this; yang_name = "addressed-key"; yang_parent_name = "rsa"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::~AddressedKey() { } bool Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::has_data() const { if (is_presence_container) return true; return ip.is_set || use.is_set || address.is_set || serial_number.is_set || (key_string != nullptr && key_string->has_data()) || (default_ != nullptr && default_->has_data()); } bool Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::has_operation() const { return is_set(yfilter) || ydk::is_set(ip.yfilter) || ydk::is_set(use.yfilter) || ydk::is_set(address.yfilter) || ydk::is_set(serial_number.yfilter) || (key_string != nullptr && key_string->has_operation()) || (default_ != nullptr && default_->has_operation()); } std::string Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:key/pubkey-chain/rsa/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "addressed-key"; ADD_KEY_TOKEN(ip, "ip"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (ip.is_set || is_set(ip.yfilter)) leaf_name_data.push_back(ip.get_name_leafdata()); if (use.is_set || is_set(use.yfilter)) leaf_name_data.push_back(use.get_name_leafdata()); if (address.is_set || is_set(address.yfilter)) leaf_name_data.push_back(address.get_name_leafdata()); if (serial_number.is_set || is_set(serial_number.yfilter)) leaf_name_data.push_back(serial_number.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "key-string") { if(key_string == nullptr) { key_string = std::make_shared<Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::KeyString>(); } return key_string; } if(child_yang_name == "default") { if(default_ == nullptr) { default_ = std::make_shared<Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::Default>(); } return default_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(key_string != nullptr) { _children["key-string"] = key_string; } if(default_ != nullptr) { _children["default"] = default_; } return _children; } void Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "ip") { ip = value; ip.value_namespace = name_space; ip.value_namespace_prefix = name_space_prefix; } if(value_path == "use") { use = value; use.value_namespace = name_space; use.value_namespace_prefix = name_space_prefix; } if(value_path == "address") { address = value; address.value_namespace = name_space; address.value_namespace_prefix = name_space_prefix; } if(value_path == "serial-number") { serial_number = value; serial_number.value_namespace = name_space; serial_number.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ip") { ip.yfilter = yfilter; } if(value_path == "use") { use.yfilter = yfilter; } if(value_path == "address") { address.yfilter = yfilter; } if(value_path == "serial-number") { serial_number.yfilter = yfilter; } } bool Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::has_leaf_or_child_of_name(const std::string & name) const { if(name == "key-string" || name == "default" || name == "ip" || name == "use" || name == "address" || name == "serial-number") return true; return false; } Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::KeyString::KeyString() : hex_data{YType::str, "hex-data"}, quit{YType::empty, "quit"} { yang_name = "key-string"; yang_parent_name = "addressed-key"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::KeyString::~KeyString() { } bool Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::KeyString::has_data() const { if (is_presence_container) return true; return hex_data.is_set || quit.is_set; } bool Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::KeyString::has_operation() const { return is_set(yfilter) || ydk::is_set(hex_data.yfilter) || ydk::is_set(quit.yfilter); } std::string Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::KeyString::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "key-string"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::KeyString::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (hex_data.is_set || is_set(hex_data.yfilter)) leaf_name_data.push_back(hex_data.get_name_leafdata()); if (quit.is_set || is_set(quit.yfilter)) leaf_name_data.push_back(quit.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::KeyString::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::KeyString::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::KeyString::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "hex-data") { hex_data = value; hex_data.value_namespace = name_space; hex_data.value_namespace_prefix = name_space_prefix; } if(value_path == "quit") { quit = value; quit.value_namespace = name_space; quit.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::KeyString::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "hex-data") { hex_data.yfilter = yfilter; } if(value_path == "quit") { quit.yfilter = yfilter; } } bool Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::KeyString::has_leaf_or_child_of_name(const std::string & name) const { if(name == "hex-data" || name == "quit") return true; return false; } Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::Default::Default() : address{YType::empty, "address"}, serial_number{YType::empty, "serial-number"} , key_string(nullptr) // presence node { yang_name = "default"; yang_parent_name = "addressed-key"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::Default::~Default() { } bool Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::Default::has_data() const { if (is_presence_container) return true; return address.is_set || serial_number.is_set || (key_string != nullptr && key_string->has_data()); } bool Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::Default::has_operation() const { return is_set(yfilter) || ydk::is_set(address.yfilter) || ydk::is_set(serial_number.yfilter) || (key_string != nullptr && key_string->has_operation()); } std::string Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::Default::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "default"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::Default::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (address.is_set || is_set(address.yfilter)) leaf_name_data.push_back(address.get_name_leafdata()); if (serial_number.is_set || is_set(serial_number.yfilter)) leaf_name_data.push_back(serial_number.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::Default::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "key-string") { if(key_string == nullptr) { key_string = std::make_shared<Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::Default::KeyString>(); } return key_string; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::Default::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(key_string != nullptr) { _children["key-string"] = key_string; } return _children; } void Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::Default::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "address") { address = value; address.value_namespace = name_space; address.value_namespace_prefix = name_space_prefix; } if(value_path == "serial-number") { serial_number = value; serial_number.value_namespace = name_space; serial_number.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::Default::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "address") { address.yfilter = yfilter; } if(value_path == "serial-number") { serial_number.yfilter = yfilter; } } bool Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::Default::has_leaf_or_child_of_name(const std::string & name) const { if(name == "key-string" || name == "address" || name == "serial-number") return true; return false; } Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::Default::KeyString::KeyString() { yang_name = "key-string"; yang_parent_name = "default"; is_top_level_class = false; has_list_ancestor = true; is_presence_container = true; } Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::Default::KeyString::~KeyString() { } bool Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::Default::KeyString::has_data() const { if (is_presence_container) return true; return false; } bool Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::Default::KeyString::has_operation() const { return is_set(yfilter); } std::string Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::Default::KeyString::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "key-string"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::Default::KeyString::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::Default::KeyString::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::Default::KeyString::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::Default::KeyString::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::Default::KeyString::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::Default::KeyString::has_leaf_or_child_of_name(const std::string & name) const { return false; } Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::NamedKey() : name{YType::str, "name"}, use{YType::enumeration, "use"}, address{YType::str, "address"}, serial_number{YType::str, "serial-number"} , key_string(std::make_shared<Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::KeyString>()) , default_(std::make_shared<Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::Default>()) { key_string->parent = this; default_->parent = this; yang_name = "named-key"; yang_parent_name = "rsa"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::~NamedKey() { } bool Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::has_data() const { if (is_presence_container) return true; return name.is_set || use.is_set || address.is_set || serial_number.is_set || (key_string != nullptr && key_string->has_data()) || (default_ != nullptr && default_->has_data()); } bool Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::has_operation() const { return is_set(yfilter) || ydk::is_set(name.yfilter) || ydk::is_set(use.yfilter) || ydk::is_set(address.yfilter) || ydk::is_set(serial_number.yfilter) || (key_string != nullptr && key_string->has_operation()) || (default_ != nullptr && default_->has_operation()); } std::string Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:key/pubkey-chain/rsa/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "named-key"; ADD_KEY_TOKEN(name, "name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (name.is_set || is_set(name.yfilter)) leaf_name_data.push_back(name.get_name_leafdata()); if (use.is_set || is_set(use.yfilter)) leaf_name_data.push_back(use.get_name_leafdata()); if (address.is_set || is_set(address.yfilter)) leaf_name_data.push_back(address.get_name_leafdata()); if (serial_number.is_set || is_set(serial_number.yfilter)) leaf_name_data.push_back(serial_number.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "key-string") { if(key_string == nullptr) { key_string = std::make_shared<Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::KeyString>(); } return key_string; } if(child_yang_name == "default") { if(default_ == nullptr) { default_ = std::make_shared<Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::Default>(); } return default_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(key_string != nullptr) { _children["key-string"] = key_string; } if(default_ != nullptr) { _children["default"] = default_; } return _children; } void Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "name") { name = value; name.value_namespace = name_space; name.value_namespace_prefix = name_space_prefix; } if(value_path == "use") { use = value; use.value_namespace = name_space; use.value_namespace_prefix = name_space_prefix; } if(value_path == "address") { address = value; address.value_namespace = name_space; address.value_namespace_prefix = name_space_prefix; } if(value_path == "serial-number") { serial_number = value; serial_number.value_namespace = name_space; serial_number.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "name") { name.yfilter = yfilter; } if(value_path == "use") { use.yfilter = yfilter; } if(value_path == "address") { address.yfilter = yfilter; } if(value_path == "serial-number") { serial_number.yfilter = yfilter; } } bool Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::has_leaf_or_child_of_name(const std::string & name) const { if(name == "key-string" || name == "default" || name == "name" || name == "use" || name == "address" || name == "serial-number") return true; return false; } Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::KeyString::KeyString() : hex_data{YType::str, "hex-data"}, quit{YType::empty, "quit"} { yang_name = "key-string"; yang_parent_name = "named-key"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::KeyString::~KeyString() { } bool Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::KeyString::has_data() const { if (is_presence_container) return true; return hex_data.is_set || quit.is_set; } bool Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::KeyString::has_operation() const { return is_set(yfilter) || ydk::is_set(hex_data.yfilter) || ydk::is_set(quit.yfilter); } std::string Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::KeyString::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "key-string"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::KeyString::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (hex_data.is_set || is_set(hex_data.yfilter)) leaf_name_data.push_back(hex_data.get_name_leafdata()); if (quit.is_set || is_set(quit.yfilter)) leaf_name_data.push_back(quit.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::KeyString::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::KeyString::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::KeyString::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "hex-data") { hex_data = value; hex_data.value_namespace = name_space; hex_data.value_namespace_prefix = name_space_prefix; } if(value_path == "quit") { quit = value; quit.value_namespace = name_space; quit.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::KeyString::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "hex-data") { hex_data.yfilter = yfilter; } if(value_path == "quit") { quit.yfilter = yfilter; } } bool Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::KeyString::has_leaf_or_child_of_name(const std::string & name) const { if(name == "hex-data" || name == "quit") return true; return false; } Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::Default::Default() : address{YType::empty, "address"}, serial_number{YType::empty, "serial-number"} , key_string(nullptr) // presence node { yang_name = "default"; yang_parent_name = "named-key"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::Default::~Default() { } bool Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::Default::has_data() const { if (is_presence_container) return true; return address.is_set || serial_number.is_set || (key_string != nullptr && key_string->has_data()); } bool Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::Default::has_operation() const { return is_set(yfilter) || ydk::is_set(address.yfilter) || ydk::is_set(serial_number.yfilter) || (key_string != nullptr && key_string->has_operation()); } std::string Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::Default::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "default"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::Default::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (address.is_set || is_set(address.yfilter)) leaf_name_data.push_back(address.get_name_leafdata()); if (serial_number.is_set || is_set(serial_number.yfilter)) leaf_name_data.push_back(serial_number.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::Default::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "key-string") { if(key_string == nullptr) { key_string = std::make_shared<Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::Default::KeyString>(); } return key_string; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::Default::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(key_string != nullptr) { _children["key-string"] = key_string; } return _children; } void Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::Default::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "address") { address = value; address.value_namespace = name_space; address.value_namespace_prefix = name_space_prefix; } if(value_path == "serial-number") { serial_number = value; serial_number.value_namespace = name_space; serial_number.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::Default::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "address") { address.yfilter = yfilter; } if(value_path == "serial-number") { serial_number.yfilter = yfilter; } } bool Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::Default::has_leaf_or_child_of_name(const std::string & name) const { if(name == "key-string" || name == "address" || name == "serial-number") return true; return false; } Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::Default::KeyString::KeyString() { yang_name = "key-string"; yang_parent_name = "default"; is_top_level_class = false; has_list_ancestor = true; is_presence_container = true; } Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::Default::KeyString::~KeyString() { } bool Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::Default::KeyString::has_data() const { if (is_presence_container) return true; return false; } bool Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::Default::KeyString::has_operation() const { return is_set(yfilter); } std::string Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::Default::KeyString::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "key-string"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::Default::KeyString::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::Default::KeyString::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::Default::KeyString::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::Default::KeyString::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::Default::KeyString::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::Default::KeyString::has_leaf_or_child_of_name(const std::string & name) const { return false; } Native::Crypto::Key::PubkeyChain::Rsa::Default::Default() : addressed_key(this, {"ip"}) , named_key(this, {"name"}) { yang_name = "default"; yang_parent_name = "rsa"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Key::PubkeyChain::Rsa::Default::~Default() { } bool Native::Crypto::Key::PubkeyChain::Rsa::Default::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<addressed_key.len(); index++) { if(addressed_key[index]->has_data()) return true; } for (std::size_t index=0; index<named_key.len(); index++) { if(named_key[index]->has_data()) return true; } return false; } bool Native::Crypto::Key::PubkeyChain::Rsa::Default::has_operation() const { for (std::size_t index=0; index<addressed_key.len(); index++) { if(addressed_key[index]->has_operation()) return true; } for (std::size_t index=0; index<named_key.len(); index++) { if(named_key[index]->has_operation()) return true; } return is_set(yfilter); } std::string Native::Crypto::Key::PubkeyChain::Rsa::Default::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:key/pubkey-chain/rsa/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Key::PubkeyChain::Rsa::Default::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "default"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::PubkeyChain::Rsa::Default::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::PubkeyChain::Rsa::Default::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "addressed-key") { auto ent_ = std::make_shared<Native::Crypto::Key::PubkeyChain::Rsa::Default::AddressedKey>(); ent_->parent = this; addressed_key.append(ent_); return ent_; } if(child_yang_name == "named-key") { auto ent_ = std::make_shared<Native::Crypto::Key::PubkeyChain::Rsa::Default::NamedKey>(); ent_->parent = this; named_key.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::PubkeyChain::Rsa::Default::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : addressed_key.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } count_ = 0; for (auto ent_ : named_key.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void Native::Crypto::Key::PubkeyChain::Rsa::Default::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Key::PubkeyChain::Rsa::Default::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Key::PubkeyChain::Rsa::Default::has_leaf_or_child_of_name(const std::string & name) const { if(name == "addressed-key" || name == "named-key") return true; return false; } Native::Crypto::Key::PubkeyChain::Rsa::Default::AddressedKey::AddressedKey() : ip{YType::str, "ip"}, use{YType::enumeration, "use"} { yang_name = "addressed-key"; yang_parent_name = "default"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Key::PubkeyChain::Rsa::Default::AddressedKey::~AddressedKey() { } bool Native::Crypto::Key::PubkeyChain::Rsa::Default::AddressedKey::has_data() const { if (is_presence_container) return true; return ip.is_set || use.is_set; } bool Native::Crypto::Key::PubkeyChain::Rsa::Default::AddressedKey::has_operation() const { return is_set(yfilter) || ydk::is_set(ip.yfilter) || ydk::is_set(use.yfilter); } std::string Native::Crypto::Key::PubkeyChain::Rsa::Default::AddressedKey::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:key/pubkey-chain/rsa/default/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Key::PubkeyChain::Rsa::Default::AddressedKey::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "addressed-key"; ADD_KEY_TOKEN(ip, "ip"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::PubkeyChain::Rsa::Default::AddressedKey::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (ip.is_set || is_set(ip.yfilter)) leaf_name_data.push_back(ip.get_name_leafdata()); if (use.is_set || is_set(use.yfilter)) leaf_name_data.push_back(use.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::PubkeyChain::Rsa::Default::AddressedKey::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::PubkeyChain::Rsa::Default::AddressedKey::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Key::PubkeyChain::Rsa::Default::AddressedKey::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "ip") { ip = value; ip.value_namespace = name_space; ip.value_namespace_prefix = name_space_prefix; } if(value_path == "use") { use = value; use.value_namespace = name_space; use.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Key::PubkeyChain::Rsa::Default::AddressedKey::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ip") { ip.yfilter = yfilter; } if(value_path == "use") { use.yfilter = yfilter; } } bool Native::Crypto::Key::PubkeyChain::Rsa::Default::AddressedKey::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ip" || name == "use") return true; return false; } Native::Crypto::Key::PubkeyChain::Rsa::Default::NamedKey::NamedKey() : name{YType::str, "name"}, use{YType::enumeration, "use"} { yang_name = "named-key"; yang_parent_name = "default"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Key::PubkeyChain::Rsa::Default::NamedKey::~NamedKey() { } bool Native::Crypto::Key::PubkeyChain::Rsa::Default::NamedKey::has_data() const { if (is_presence_container) return true; return name.is_set || use.is_set; } bool Native::Crypto::Key::PubkeyChain::Rsa::Default::NamedKey::has_operation() const { return is_set(yfilter) || ydk::is_set(name.yfilter) || ydk::is_set(use.yfilter); } std::string Native::Crypto::Key::PubkeyChain::Rsa::Default::NamedKey::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:key/pubkey-chain/rsa/default/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Key::PubkeyChain::Rsa::Default::NamedKey::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "named-key"; ADD_KEY_TOKEN(name, "name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::PubkeyChain::Rsa::Default::NamedKey::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (name.is_set || is_set(name.yfilter)) leaf_name_data.push_back(name.get_name_leafdata()); if (use.is_set || is_set(use.yfilter)) leaf_name_data.push_back(use.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::PubkeyChain::Rsa::Default::NamedKey::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::PubkeyChain::Rsa::Default::NamedKey::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Key::PubkeyChain::Rsa::Default::NamedKey::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "name") { name = value; name.value_namespace = name_space; name.value_namespace_prefix = name_space_prefix; } if(value_path == "use") { use = value; use.value_namespace = name_space; use.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Key::PubkeyChain::Rsa::Default::NamedKey::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "name") { name.yfilter = yfilter; } if(value_path == "use") { use.yfilter = yfilter; } } bool Native::Crypto::Key::PubkeyChain::Rsa::Default::NamedKey::has_leaf_or_child_of_name(const std::string & name) const { if(name == "name" || name == "use") return true; return false; } Native::Crypto::Key::Zeroize::Zeroize() : ec(nullptr) // presence node , pubkey_chain(nullptr) // presence node , rsa(nullptr) // presence node { yang_name = "zeroize"; yang_parent_name = "key"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Key::Zeroize::~Zeroize() { } bool Native::Crypto::Key::Zeroize::has_data() const { if (is_presence_container) return true; return (ec != nullptr && ec->has_data()) || (pubkey_chain != nullptr && pubkey_chain->has_data()) || (rsa != nullptr && rsa->has_data()); } bool Native::Crypto::Key::Zeroize::has_operation() const { return is_set(yfilter) || (ec != nullptr && ec->has_operation()) || (pubkey_chain != nullptr && pubkey_chain->has_operation()) || (rsa != nullptr && rsa->has_operation()); } std::string Native::Crypto::Key::Zeroize::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:key/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Key::Zeroize::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "zeroize"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::Zeroize::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::Zeroize::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "ec") { if(ec == nullptr) { ec = std::make_shared<Native::Crypto::Key::Zeroize::Ec>(); } return ec; } if(child_yang_name == "pubkey-chain") { if(pubkey_chain == nullptr) { pubkey_chain = std::make_shared<Native::Crypto::Key::Zeroize::PubkeyChain>(); } return pubkey_chain; } if(child_yang_name == "rsa") { if(rsa == nullptr) { rsa = std::make_shared<Native::Crypto::Key::Zeroize::Rsa>(); } return rsa; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::Zeroize::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(ec != nullptr) { _children["ec"] = ec; } if(pubkey_chain != nullptr) { _children["pubkey-chain"] = pubkey_chain; } if(rsa != nullptr) { _children["rsa"] = rsa; } return _children; } void Native::Crypto::Key::Zeroize::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Key::Zeroize::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Key::Zeroize::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ec" || name == "pubkey-chain" || name == "rsa") return true; return false; } Native::Crypto::Key::Zeroize::Ec::Ec() : label{YType::str, "label"} { yang_name = "ec"; yang_parent_name = "zeroize"; is_top_level_class = false; has_list_ancestor = false; is_presence_container = true; } Native::Crypto::Key::Zeroize::Ec::~Ec() { } bool Native::Crypto::Key::Zeroize::Ec::has_data() const { if (is_presence_container) return true; return label.is_set; } bool Native::Crypto::Key::Zeroize::Ec::has_operation() const { return is_set(yfilter) || ydk::is_set(label.yfilter); } std::string Native::Crypto::Key::Zeroize::Ec::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:key/zeroize/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Key::Zeroize::Ec::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ec"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::Zeroize::Ec::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (label.is_set || is_set(label.yfilter)) leaf_name_data.push_back(label.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::Zeroize::Ec::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::Zeroize::Ec::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Key::Zeroize::Ec::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "label") { label = value; label.value_namespace = name_space; label.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Key::Zeroize::Ec::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "label") { label.yfilter = yfilter; } } bool Native::Crypto::Key::Zeroize::Ec::has_leaf_or_child_of_name(const std::string & name) const { if(name == "label") return true; return false; } Native::Crypto::Key::Zeroize::PubkeyChain::PubkeyChain() : index_{YType::uint16, "index"} { yang_name = "pubkey-chain"; yang_parent_name = "zeroize"; is_top_level_class = false; has_list_ancestor = false; is_presence_container = true; } Native::Crypto::Key::Zeroize::PubkeyChain::~PubkeyChain() { } bool Native::Crypto::Key::Zeroize::PubkeyChain::has_data() const { if (is_presence_container) return true; return index_.is_set; } bool Native::Crypto::Key::Zeroize::PubkeyChain::has_operation() const { return is_set(yfilter) || ydk::is_set(index_.yfilter); } std::string Native::Crypto::Key::Zeroize::PubkeyChain::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:key/zeroize/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Key::Zeroize::PubkeyChain::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "pubkey-chain"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::Zeroize::PubkeyChain::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (index_.is_set || is_set(index_.yfilter)) leaf_name_data.push_back(index_.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::Zeroize::PubkeyChain::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::Zeroize::PubkeyChain::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Key::Zeroize::PubkeyChain::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "index") { index_ = value; index_.value_namespace = name_space; index_.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Key::Zeroize::PubkeyChain::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "index") { index_.yfilter = yfilter; } } bool Native::Crypto::Key::Zeroize::PubkeyChain::has_leaf_or_child_of_name(const std::string & name) const { if(name == "index") return true; return false; } Native::Crypto::Key::Zeroize::Rsa::Rsa() : label{YType::str, "label"} { yang_name = "rsa"; yang_parent_name = "zeroize"; is_top_level_class = false; has_list_ancestor = false; is_presence_container = true; } Native::Crypto::Key::Zeroize::Rsa::~Rsa() { } bool Native::Crypto::Key::Zeroize::Rsa::has_data() const { if (is_presence_container) return true; return label.is_set; } bool Native::Crypto::Key::Zeroize::Rsa::has_operation() const { return is_set(yfilter) || ydk::is_set(label.yfilter); } std::string Native::Crypto::Key::Zeroize::Rsa::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:key/zeroize/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Key::Zeroize::Rsa::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "rsa"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Key::Zeroize::Rsa::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (label.is_set || is_set(label.yfilter)) leaf_name_data.push_back(label.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Key::Zeroize::Rsa::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Key::Zeroize::Rsa::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Key::Zeroize::Rsa::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "label") { label = value; label.value_namespace = name_space; label.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Key::Zeroize::Rsa::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "label") { label.yfilter = yfilter; } } bool Native::Crypto::Key::Zeroize::Rsa::has_leaf_or_child_of_name(const std::string & name) const { if(name == "label") return true; return false; } Native::Crypto::Keyring::Keyring() : name{YType::str, "name"}, vrf{YType::str, "vrf"}, description{YType::str, "description"} , default_(std::make_shared<Native::Crypto::Keyring::Default>()) , local_address(std::make_shared<Native::Crypto::Keyring::LocalAddress>()) , pre_shared_key(std::make_shared<Native::Crypto::Keyring::PreSharedKey>()) , rsa_pubkey(std::make_shared<Native::Crypto::Keyring::RsaPubkey>()) { default_->parent = this; local_address->parent = this; pre_shared_key->parent = this; rsa_pubkey->parent = this; yang_name = "keyring"; yang_parent_name = "crypto"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Keyring::~Keyring() { } bool Native::Crypto::Keyring::has_data() const { if (is_presence_container) return true; return name.is_set || vrf.is_set || description.is_set || (default_ != nullptr && default_->has_data()) || (local_address != nullptr && local_address->has_data()) || (pre_shared_key != nullptr && pre_shared_key->has_data()) || (rsa_pubkey != nullptr && rsa_pubkey->has_data()); } bool Native::Crypto::Keyring::has_operation() const { return is_set(yfilter) || ydk::is_set(name.yfilter) || ydk::is_set(vrf.yfilter) || ydk::is_set(description.yfilter) || (default_ != nullptr && default_->has_operation()) || (local_address != nullptr && local_address->has_operation()) || (pre_shared_key != nullptr && pre_shared_key->has_operation()) || (rsa_pubkey != nullptr && rsa_pubkey->has_operation()); } std::string Native::Crypto::Keyring::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Keyring::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-crypto:keyring"; ADD_KEY_TOKEN(name, "name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (name.is_set || is_set(name.yfilter)) leaf_name_data.push_back(name.get_name_leafdata()); if (vrf.is_set || is_set(vrf.yfilter)) leaf_name_data.push_back(vrf.get_name_leafdata()); if (description.is_set || is_set(description.yfilter)) leaf_name_data.push_back(description.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "default") { if(default_ == nullptr) { default_ = std::make_shared<Native::Crypto::Keyring::Default>(); } return default_; } if(child_yang_name == "local-address") { if(local_address == nullptr) { local_address = std::make_shared<Native::Crypto::Keyring::LocalAddress>(); } return local_address; } if(child_yang_name == "pre-shared-key") { if(pre_shared_key == nullptr) { pre_shared_key = std::make_shared<Native::Crypto::Keyring::PreSharedKey>(); } return pre_shared_key; } if(child_yang_name == "rsa-pubkey") { if(rsa_pubkey == nullptr) { rsa_pubkey = std::make_shared<Native::Crypto::Keyring::RsaPubkey>(); } return rsa_pubkey; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(default_ != nullptr) { _children["default"] = default_; } if(local_address != nullptr) { _children["local-address"] = local_address; } if(pre_shared_key != nullptr) { _children["pre-shared-key"] = pre_shared_key; } if(rsa_pubkey != nullptr) { _children["rsa-pubkey"] = rsa_pubkey; } return _children; } void Native::Crypto::Keyring::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "name") { name = value; name.value_namespace = name_space; name.value_namespace_prefix = name_space_prefix; } if(value_path == "vrf") { vrf = value; vrf.value_namespace = name_space; vrf.value_namespace_prefix = name_space_prefix; } if(value_path == "description") { description = value; description.value_namespace = name_space; description.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Keyring::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "name") { name.yfilter = yfilter; } if(value_path == "vrf") { vrf.yfilter = yfilter; } if(value_path == "description") { description.yfilter = yfilter; } } bool Native::Crypto::Keyring::has_leaf_or_child_of_name(const std::string & name) const { if(name == "default" || name == "local-address" || name == "pre-shared-key" || name == "rsa-pubkey" || name == "name" || name == "vrf" || name == "description") return true; return false; } Native::Crypto::Keyring::Default::Default() : description{YType::str, "description"} , local_address(std::make_shared<Native::Crypto::Keyring::Default::LocalAddress>()) , pre_shared_key(std::make_shared<Native::Crypto::Keyring::Default::PreSharedKey>()) , rsa_pubkey(std::make_shared<Native::Crypto::Keyring::Default::RsaPubkey>()) { local_address->parent = this; pre_shared_key->parent = this; rsa_pubkey->parent = this; yang_name = "default"; yang_parent_name = "keyring"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::Default::~Default() { } bool Native::Crypto::Keyring::Default::has_data() const { if (is_presence_container) return true; return description.is_set || (local_address != nullptr && local_address->has_data()) || (pre_shared_key != nullptr && pre_shared_key->has_data()) || (rsa_pubkey != nullptr && rsa_pubkey->has_data()); } bool Native::Crypto::Keyring::Default::has_operation() const { return is_set(yfilter) || ydk::is_set(description.yfilter) || (local_address != nullptr && local_address->has_operation()) || (pre_shared_key != nullptr && pre_shared_key->has_operation()) || (rsa_pubkey != nullptr && rsa_pubkey->has_operation()); } std::string Native::Crypto::Keyring::Default::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "default"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::Default::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (description.is_set || is_set(description.yfilter)) leaf_name_data.push_back(description.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::Default::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "local-address") { if(local_address == nullptr) { local_address = std::make_shared<Native::Crypto::Keyring::Default::LocalAddress>(); } return local_address; } if(child_yang_name == "pre-shared-key") { if(pre_shared_key == nullptr) { pre_shared_key = std::make_shared<Native::Crypto::Keyring::Default::PreSharedKey>(); } return pre_shared_key; } if(child_yang_name == "rsa-pubkey") { if(rsa_pubkey == nullptr) { rsa_pubkey = std::make_shared<Native::Crypto::Keyring::Default::RsaPubkey>(); } return rsa_pubkey; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::Default::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(local_address != nullptr) { _children["local-address"] = local_address; } if(pre_shared_key != nullptr) { _children["pre-shared-key"] = pre_shared_key; } if(rsa_pubkey != nullptr) { _children["rsa-pubkey"] = rsa_pubkey; } return _children; } void Native::Crypto::Keyring::Default::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "description") { description = value; description.value_namespace = name_space; description.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Keyring::Default::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "description") { description.yfilter = yfilter; } } bool Native::Crypto::Keyring::Default::has_leaf_or_child_of_name(const std::string & name) const { if(name == "local-address" || name == "pre-shared-key" || name == "rsa-pubkey" || name == "description") return true; return false; } Native::Crypto::Keyring::Default::LocalAddress::LocalAddress() : appnav_compress{YType::uint16, "AppNav-Compress"}, appnav_uncompress{YType::uint16, "AppNav-UnCompress"}, atm{YType::str, "ATM"}, atm_acr{YType::str, "ATM-ACR"}, bdi{YType::str, "BDI"}, cem{YType::str, "CEM"}, cem_acr{YType::uint8, "CEM-ACR"}, embedded_service_engine{YType::str, "Embedded-Service-Engine"}, ethernet{YType::str, "Ethernet"}, fastethernet{YType::str, "FastEthernet"}, gigabitethernet{YType::str, "GigabitEthernet"}, fivegigabitethernet{YType::str, "FiveGigabitEthernet"}, twentyfivegige{YType::str, "TwentyFiveGigE"}, twogigabitethernet{YType::str, "TwoGigabitEthernet"}, fortygigabitethernet{YType::str, "FortyGigabitEthernet"}, hundredgige{YType::str, "HundredGigE"}, lisp{YType::str, "LISP"}, loopback{YType::uint32, "Loopback"}, multilink{YType::uint16, "Multilink"}, nve{YType::uint16, "nve"}, overlay{YType::uint16, "overlay"}, port_channel{YType::uint32, "Port-channel"}, pseudowire{YType::uint32, "pseudowire"}, sm{YType::str, "SM"}, cellular{YType::str, "Cellular"}, serial{YType::str, "Serial"}, tengigabitethernet{YType::str, "TenGigabitEthernet"}, tunnel{YType::uint32, "Tunnel"}, virtual_template{YType::uint16, "Virtual-Template"}, vlan{YType::uint16, "Vlan"}, virtualportgroup{YType::uint16, "VirtualPortGroup"}, vasileft{YType::uint16, "vasileft"}, vasiright{YType::uint16, "vasiright"} , bind_ip_address(std::make_shared<Native::Crypto::Keyring::Default::LocalAddress::BindIpAddress>()) , atm_subinterface(std::make_shared<Native::Crypto::Keyring::Default::LocalAddress::ATMSubinterface>()) , atm_acrsubinterface(std::make_shared<Native::Crypto::Keyring::Default::LocalAddress::ATMACRsubinterface>()) , lisp_subinterface(std::make_shared<Native::Crypto::Keyring::Default::LocalAddress::LISPSubinterface>()) , port_channel_subinterface(std::make_shared<Native::Crypto::Keyring::Default::LocalAddress::PortChannelSubinterface>()) { bind_ip_address->parent = this; atm_subinterface->parent = this; atm_acrsubinterface->parent = this; lisp_subinterface->parent = this; port_channel_subinterface->parent = this; yang_name = "local-address"; yang_parent_name = "default"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::Default::LocalAddress::~LocalAddress() { } bool Native::Crypto::Keyring::Default::LocalAddress::has_data() const { if (is_presence_container) return true; return appnav_compress.is_set || appnav_uncompress.is_set || atm.is_set || atm_acr.is_set || bdi.is_set || cem.is_set || cem_acr.is_set || embedded_service_engine.is_set || ethernet.is_set || fastethernet.is_set || gigabitethernet.is_set || fivegigabitethernet.is_set || twentyfivegige.is_set || twogigabitethernet.is_set || fortygigabitethernet.is_set || hundredgige.is_set || lisp.is_set || loopback.is_set || multilink.is_set || nve.is_set || overlay.is_set || port_channel.is_set || pseudowire.is_set || sm.is_set || cellular.is_set || serial.is_set || tengigabitethernet.is_set || tunnel.is_set || virtual_template.is_set || vlan.is_set || virtualportgroup.is_set || vasileft.is_set || vasiright.is_set || (bind_ip_address != nullptr && bind_ip_address->has_data()) || (atm_subinterface != nullptr && atm_subinterface->has_data()) || (atm_acrsubinterface != nullptr && atm_acrsubinterface->has_data()) || (lisp_subinterface != nullptr && lisp_subinterface->has_data()) || (port_channel_subinterface != nullptr && port_channel_subinterface->has_data()); } bool Native::Crypto::Keyring::Default::LocalAddress::has_operation() const { return is_set(yfilter) || ydk::is_set(appnav_compress.yfilter) || ydk::is_set(appnav_uncompress.yfilter) || ydk::is_set(atm.yfilter) || ydk::is_set(atm_acr.yfilter) || ydk::is_set(bdi.yfilter) || ydk::is_set(cem.yfilter) || ydk::is_set(cem_acr.yfilter) || ydk::is_set(embedded_service_engine.yfilter) || ydk::is_set(ethernet.yfilter) || ydk::is_set(fastethernet.yfilter) || ydk::is_set(gigabitethernet.yfilter) || ydk::is_set(fivegigabitethernet.yfilter) || ydk::is_set(twentyfivegige.yfilter) || ydk::is_set(twogigabitethernet.yfilter) || ydk::is_set(fortygigabitethernet.yfilter) || ydk::is_set(hundredgige.yfilter) || ydk::is_set(lisp.yfilter) || ydk::is_set(loopback.yfilter) || ydk::is_set(multilink.yfilter) || ydk::is_set(nve.yfilter) || ydk::is_set(overlay.yfilter) || ydk::is_set(port_channel.yfilter) || ydk::is_set(pseudowire.yfilter) || ydk::is_set(sm.yfilter) || ydk::is_set(cellular.yfilter) || ydk::is_set(serial.yfilter) || ydk::is_set(tengigabitethernet.yfilter) || ydk::is_set(tunnel.yfilter) || ydk::is_set(virtual_template.yfilter) || ydk::is_set(vlan.yfilter) || ydk::is_set(virtualportgroup.yfilter) || ydk::is_set(vasileft.yfilter) || ydk::is_set(vasiright.yfilter) || (bind_ip_address != nullptr && bind_ip_address->has_operation()) || (atm_subinterface != nullptr && atm_subinterface->has_operation()) || (atm_acrsubinterface != nullptr && atm_acrsubinterface->has_operation()) || (lisp_subinterface != nullptr && lisp_subinterface->has_operation()) || (port_channel_subinterface != nullptr && port_channel_subinterface->has_operation()); } std::string Native::Crypto::Keyring::Default::LocalAddress::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "local-address"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::Default::LocalAddress::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (appnav_compress.is_set || is_set(appnav_compress.yfilter)) leaf_name_data.push_back(appnav_compress.get_name_leafdata()); if (appnav_uncompress.is_set || is_set(appnav_uncompress.yfilter)) leaf_name_data.push_back(appnav_uncompress.get_name_leafdata()); if (atm.is_set || is_set(atm.yfilter)) leaf_name_data.push_back(atm.get_name_leafdata()); if (atm_acr.is_set || is_set(atm_acr.yfilter)) leaf_name_data.push_back(atm_acr.get_name_leafdata()); if (bdi.is_set || is_set(bdi.yfilter)) leaf_name_data.push_back(bdi.get_name_leafdata()); if (cem.is_set || is_set(cem.yfilter)) leaf_name_data.push_back(cem.get_name_leafdata()); if (cem_acr.is_set || is_set(cem_acr.yfilter)) leaf_name_data.push_back(cem_acr.get_name_leafdata()); if (embedded_service_engine.is_set || is_set(embedded_service_engine.yfilter)) leaf_name_data.push_back(embedded_service_engine.get_name_leafdata()); if (ethernet.is_set || is_set(ethernet.yfilter)) leaf_name_data.push_back(ethernet.get_name_leafdata()); if (fastethernet.is_set || is_set(fastethernet.yfilter)) leaf_name_data.push_back(fastethernet.get_name_leafdata()); if (gigabitethernet.is_set || is_set(gigabitethernet.yfilter)) leaf_name_data.push_back(gigabitethernet.get_name_leafdata()); if (fivegigabitethernet.is_set || is_set(fivegigabitethernet.yfilter)) leaf_name_data.push_back(fivegigabitethernet.get_name_leafdata()); if (twentyfivegige.is_set || is_set(twentyfivegige.yfilter)) leaf_name_data.push_back(twentyfivegige.get_name_leafdata()); if (twogigabitethernet.is_set || is_set(twogigabitethernet.yfilter)) leaf_name_data.push_back(twogigabitethernet.get_name_leafdata()); if (fortygigabitethernet.is_set || is_set(fortygigabitethernet.yfilter)) leaf_name_data.push_back(fortygigabitethernet.get_name_leafdata()); if (hundredgige.is_set || is_set(hundredgige.yfilter)) leaf_name_data.push_back(hundredgige.get_name_leafdata()); if (lisp.is_set || is_set(lisp.yfilter)) leaf_name_data.push_back(lisp.get_name_leafdata()); if (loopback.is_set || is_set(loopback.yfilter)) leaf_name_data.push_back(loopback.get_name_leafdata()); if (multilink.is_set || is_set(multilink.yfilter)) leaf_name_data.push_back(multilink.get_name_leafdata()); if (nve.is_set || is_set(nve.yfilter)) leaf_name_data.push_back(nve.get_name_leafdata()); if (overlay.is_set || is_set(overlay.yfilter)) leaf_name_data.push_back(overlay.get_name_leafdata()); if (port_channel.is_set || is_set(port_channel.yfilter)) leaf_name_data.push_back(port_channel.get_name_leafdata()); if (pseudowire.is_set || is_set(pseudowire.yfilter)) leaf_name_data.push_back(pseudowire.get_name_leafdata()); if (sm.is_set || is_set(sm.yfilter)) leaf_name_data.push_back(sm.get_name_leafdata()); if (cellular.is_set || is_set(cellular.yfilter)) leaf_name_data.push_back(cellular.get_name_leafdata()); if (serial.is_set || is_set(serial.yfilter)) leaf_name_data.push_back(serial.get_name_leafdata()); if (tengigabitethernet.is_set || is_set(tengigabitethernet.yfilter)) leaf_name_data.push_back(tengigabitethernet.get_name_leafdata()); if (tunnel.is_set || is_set(tunnel.yfilter)) leaf_name_data.push_back(tunnel.get_name_leafdata()); if (virtual_template.is_set || is_set(virtual_template.yfilter)) leaf_name_data.push_back(virtual_template.get_name_leafdata()); if (vlan.is_set || is_set(vlan.yfilter)) leaf_name_data.push_back(vlan.get_name_leafdata()); if (virtualportgroup.is_set || is_set(virtualportgroup.yfilter)) leaf_name_data.push_back(virtualportgroup.get_name_leafdata()); if (vasileft.is_set || is_set(vasileft.yfilter)) leaf_name_data.push_back(vasileft.get_name_leafdata()); if (vasiright.is_set || is_set(vasiright.yfilter)) leaf_name_data.push_back(vasiright.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::Default::LocalAddress::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "bind-ip-address") { if(bind_ip_address == nullptr) { bind_ip_address = std::make_shared<Native::Crypto::Keyring::Default::LocalAddress::BindIpAddress>(); } return bind_ip_address; } if(child_yang_name == "ATM-subinterface") { if(atm_subinterface == nullptr) { atm_subinterface = std::make_shared<Native::Crypto::Keyring::Default::LocalAddress::ATMSubinterface>(); } return atm_subinterface; } if(child_yang_name == "ATM-ACRsubinterface") { if(atm_acrsubinterface == nullptr) { atm_acrsubinterface = std::make_shared<Native::Crypto::Keyring::Default::LocalAddress::ATMACRsubinterface>(); } return atm_acrsubinterface; } if(child_yang_name == "LISP-subinterface") { if(lisp_subinterface == nullptr) { lisp_subinterface = std::make_shared<Native::Crypto::Keyring::Default::LocalAddress::LISPSubinterface>(); } return lisp_subinterface; } if(child_yang_name == "Port-channel-subinterface") { if(port_channel_subinterface == nullptr) { port_channel_subinterface = std::make_shared<Native::Crypto::Keyring::Default::LocalAddress::PortChannelSubinterface>(); } return port_channel_subinterface; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::Default::LocalAddress::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(bind_ip_address != nullptr) { _children["bind-ip-address"] = bind_ip_address; } if(atm_subinterface != nullptr) { _children["ATM-subinterface"] = atm_subinterface; } if(atm_acrsubinterface != nullptr) { _children["ATM-ACRsubinterface"] = atm_acrsubinterface; } if(lisp_subinterface != nullptr) { _children["LISP-subinterface"] = lisp_subinterface; } if(port_channel_subinterface != nullptr) { _children["Port-channel-subinterface"] = port_channel_subinterface; } return _children; } void Native::Crypto::Keyring::Default::LocalAddress::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "AppNav-Compress") { appnav_compress = value; appnav_compress.value_namespace = name_space; appnav_compress.value_namespace_prefix = name_space_prefix; } if(value_path == "AppNav-UnCompress") { appnav_uncompress = value; appnav_uncompress.value_namespace = name_space; appnav_uncompress.value_namespace_prefix = name_space_prefix; } if(value_path == "ATM") { atm = value; atm.value_namespace = name_space; atm.value_namespace_prefix = name_space_prefix; } if(value_path == "ATM-ACR") { atm_acr = value; atm_acr.value_namespace = name_space; atm_acr.value_namespace_prefix = name_space_prefix; } if(value_path == "BDI") { bdi = value; bdi.value_namespace = name_space; bdi.value_namespace_prefix = name_space_prefix; } if(value_path == "CEM") { cem = value; cem.value_namespace = name_space; cem.value_namespace_prefix = name_space_prefix; } if(value_path == "CEM-ACR") { cem_acr = value; cem_acr.value_namespace = name_space; cem_acr.value_namespace_prefix = name_space_prefix; } if(value_path == "Embedded-Service-Engine") { embedded_service_engine = value; embedded_service_engine.value_namespace = name_space; embedded_service_engine.value_namespace_prefix = name_space_prefix; } if(value_path == "Ethernet") { ethernet = value; ethernet.value_namespace = name_space; ethernet.value_namespace_prefix = name_space_prefix; } if(value_path == "FastEthernet") { fastethernet = value; fastethernet.value_namespace = name_space; fastethernet.value_namespace_prefix = name_space_prefix; } if(value_path == "GigabitEthernet") { gigabitethernet = value; gigabitethernet.value_namespace = name_space; gigabitethernet.value_namespace_prefix = name_space_prefix; } if(value_path == "FiveGigabitEthernet") { fivegigabitethernet = value; fivegigabitethernet.value_namespace = name_space; fivegigabitethernet.value_namespace_prefix = name_space_prefix; } if(value_path == "TwentyFiveGigE") { twentyfivegige = value; twentyfivegige.value_namespace = name_space; twentyfivegige.value_namespace_prefix = name_space_prefix; } if(value_path == "TwoGigabitEthernet") { twogigabitethernet = value; twogigabitethernet.value_namespace = name_space; twogigabitethernet.value_namespace_prefix = name_space_prefix; } if(value_path == "FortyGigabitEthernet") { fortygigabitethernet = value; fortygigabitethernet.value_namespace = name_space; fortygigabitethernet.value_namespace_prefix = name_space_prefix; } if(value_path == "HundredGigE") { hundredgige = value; hundredgige.value_namespace = name_space; hundredgige.value_namespace_prefix = name_space_prefix; } if(value_path == "LISP") { lisp = value; lisp.value_namespace = name_space; lisp.value_namespace_prefix = name_space_prefix; } if(value_path == "Loopback") { loopback = value; loopback.value_namespace = name_space; loopback.value_namespace_prefix = name_space_prefix; } if(value_path == "Multilink") { multilink = value; multilink.value_namespace = name_space; multilink.value_namespace_prefix = name_space_prefix; } if(value_path == "nve") { nve = value; nve.value_namespace = name_space; nve.value_namespace_prefix = name_space_prefix; } if(value_path == "overlay") { overlay = value; overlay.value_namespace = name_space; overlay.value_namespace_prefix = name_space_prefix; } if(value_path == "Port-channel") { port_channel = value; port_channel.value_namespace = name_space; port_channel.value_namespace_prefix = name_space_prefix; } if(value_path == "pseudowire") { pseudowire = value; pseudowire.value_namespace = name_space; pseudowire.value_namespace_prefix = name_space_prefix; } if(value_path == "SM") { sm = value; sm.value_namespace = name_space; sm.value_namespace_prefix = name_space_prefix; } if(value_path == "Cellular") { cellular = value; cellular.value_namespace = name_space; cellular.value_namespace_prefix = name_space_prefix; } if(value_path == "Serial") { serial = value; serial.value_namespace = name_space; serial.value_namespace_prefix = name_space_prefix; } if(value_path == "TenGigabitEthernet") { tengigabitethernet = value; tengigabitethernet.value_namespace = name_space; tengigabitethernet.value_namespace_prefix = name_space_prefix; } if(value_path == "Tunnel") { tunnel = value; tunnel.value_namespace = name_space; tunnel.value_namespace_prefix = name_space_prefix; } if(value_path == "Virtual-Template") { virtual_template = value; virtual_template.value_namespace = name_space; virtual_template.value_namespace_prefix = name_space_prefix; } if(value_path == "Vlan") { vlan = value; vlan.value_namespace = name_space; vlan.value_namespace_prefix = name_space_prefix; } if(value_path == "VirtualPortGroup") { virtualportgroup = value; virtualportgroup.value_namespace = name_space; virtualportgroup.value_namespace_prefix = name_space_prefix; } if(value_path == "vasileft") { vasileft = value; vasileft.value_namespace = name_space; vasileft.value_namespace_prefix = name_space_prefix; } if(value_path == "vasiright") { vasiright = value; vasiright.value_namespace = name_space; vasiright.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Keyring::Default::LocalAddress::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "AppNav-Compress") { appnav_compress.yfilter = yfilter; } if(value_path == "AppNav-UnCompress") { appnav_uncompress.yfilter = yfilter; } if(value_path == "ATM") { atm.yfilter = yfilter; } if(value_path == "ATM-ACR") { atm_acr.yfilter = yfilter; } if(value_path == "BDI") { bdi.yfilter = yfilter; } if(value_path == "CEM") { cem.yfilter = yfilter; } if(value_path == "CEM-ACR") { cem_acr.yfilter = yfilter; } if(value_path == "Embedded-Service-Engine") { embedded_service_engine.yfilter = yfilter; } if(value_path == "Ethernet") { ethernet.yfilter = yfilter; } if(value_path == "FastEthernet") { fastethernet.yfilter = yfilter; } if(value_path == "GigabitEthernet") { gigabitethernet.yfilter = yfilter; } if(value_path == "FiveGigabitEthernet") { fivegigabitethernet.yfilter = yfilter; } if(value_path == "TwentyFiveGigE") { twentyfivegige.yfilter = yfilter; } if(value_path == "TwoGigabitEthernet") { twogigabitethernet.yfilter = yfilter; } if(value_path == "FortyGigabitEthernet") { fortygigabitethernet.yfilter = yfilter; } if(value_path == "HundredGigE") { hundredgige.yfilter = yfilter; } if(value_path == "LISP") { lisp.yfilter = yfilter; } if(value_path == "Loopback") { loopback.yfilter = yfilter; } if(value_path == "Multilink") { multilink.yfilter = yfilter; } if(value_path == "nve") { nve.yfilter = yfilter; } if(value_path == "overlay") { overlay.yfilter = yfilter; } if(value_path == "Port-channel") { port_channel.yfilter = yfilter; } if(value_path == "pseudowire") { pseudowire.yfilter = yfilter; } if(value_path == "SM") { sm.yfilter = yfilter; } if(value_path == "Cellular") { cellular.yfilter = yfilter; } if(value_path == "Serial") { serial.yfilter = yfilter; } if(value_path == "TenGigabitEthernet") { tengigabitethernet.yfilter = yfilter; } if(value_path == "Tunnel") { tunnel.yfilter = yfilter; } if(value_path == "Virtual-Template") { virtual_template.yfilter = yfilter; } if(value_path == "Vlan") { vlan.yfilter = yfilter; } if(value_path == "VirtualPortGroup") { virtualportgroup.yfilter = yfilter; } if(value_path == "vasileft") { vasileft.yfilter = yfilter; } if(value_path == "vasiright") { vasiright.yfilter = yfilter; } } bool Native::Crypto::Keyring::Default::LocalAddress::has_leaf_or_child_of_name(const std::string & name) const { if(name == "bind-ip-address" || name == "ATM-subinterface" || name == "ATM-ACRsubinterface" || name == "LISP-subinterface" || name == "Port-channel-subinterface" || name == "AppNav-Compress" || name == "AppNav-UnCompress" || name == "ATM" || name == "ATM-ACR" || name == "BDI" || name == "CEM" || name == "CEM-ACR" || name == "Embedded-Service-Engine" || name == "Ethernet" || name == "FastEthernet" || name == "GigabitEthernet" || name == "FiveGigabitEthernet" || name == "TwentyFiveGigE" || name == "TwoGigabitEthernet" || name == "FortyGigabitEthernet" || name == "HundredGigE" || name == "LISP" || name == "Loopback" || name == "Multilink" || name == "nve" || name == "overlay" || name == "Port-channel" || name == "pseudowire" || name == "SM" || name == "Cellular" || name == "Serial" || name == "TenGigabitEthernet" || name == "Tunnel" || name == "Virtual-Template" || name == "Vlan" || name == "VirtualPortGroup" || name == "vasileft" || name == "vasiright") return true; return false; } Native::Crypto::Keyring::Default::LocalAddress::BindIpAddress::BindIpAddress() : ip_address{YType::str, "ip-address"}, vrf{YType::str, "vrf"} { yang_name = "bind-ip-address"; yang_parent_name = "local-address"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::Default::LocalAddress::BindIpAddress::~BindIpAddress() { } bool Native::Crypto::Keyring::Default::LocalAddress::BindIpAddress::has_data() const { if (is_presence_container) return true; return ip_address.is_set || vrf.is_set; } bool Native::Crypto::Keyring::Default::LocalAddress::BindIpAddress::has_operation() const { return is_set(yfilter) || ydk::is_set(ip_address.yfilter) || ydk::is_set(vrf.yfilter); } std::string Native::Crypto::Keyring::Default::LocalAddress::BindIpAddress::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "bind-ip-address"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::Default::LocalAddress::BindIpAddress::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (ip_address.is_set || is_set(ip_address.yfilter)) leaf_name_data.push_back(ip_address.get_name_leafdata()); if (vrf.is_set || is_set(vrf.yfilter)) leaf_name_data.push_back(vrf.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::Default::LocalAddress::BindIpAddress::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::Default::LocalAddress::BindIpAddress::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Keyring::Default::LocalAddress::BindIpAddress::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "ip-address") { ip_address = value; ip_address.value_namespace = name_space; ip_address.value_namespace_prefix = name_space_prefix; } if(value_path == "vrf") { vrf = value; vrf.value_namespace = name_space; vrf.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Keyring::Default::LocalAddress::BindIpAddress::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ip-address") { ip_address.yfilter = yfilter; } if(value_path == "vrf") { vrf.yfilter = yfilter; } } bool Native::Crypto::Keyring::Default::LocalAddress::BindIpAddress::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ip-address" || name == "vrf") return true; return false; } Native::Crypto::Keyring::Default::LocalAddress::ATMSubinterface::ATMSubinterface() : atm{YType::str, "ATM"} { yang_name = "ATM-subinterface"; yang_parent_name = "local-address"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::Default::LocalAddress::ATMSubinterface::~ATMSubinterface() { } bool Native::Crypto::Keyring::Default::LocalAddress::ATMSubinterface::has_data() const { if (is_presence_container) return true; return atm.is_set; } bool Native::Crypto::Keyring::Default::LocalAddress::ATMSubinterface::has_operation() const { return is_set(yfilter) || ydk::is_set(atm.yfilter); } std::string Native::Crypto::Keyring::Default::LocalAddress::ATMSubinterface::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ATM-subinterface"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::Default::LocalAddress::ATMSubinterface::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (atm.is_set || is_set(atm.yfilter)) leaf_name_data.push_back(atm.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::Default::LocalAddress::ATMSubinterface::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::Default::LocalAddress::ATMSubinterface::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Keyring::Default::LocalAddress::ATMSubinterface::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "ATM") { atm = value; atm.value_namespace = name_space; atm.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Keyring::Default::LocalAddress::ATMSubinterface::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ATM") { atm.yfilter = yfilter; } } bool Native::Crypto::Keyring::Default::LocalAddress::ATMSubinterface::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ATM") return true; return false; } Native::Crypto::Keyring::Default::LocalAddress::ATMACRsubinterface::ATMACRsubinterface() : atm_acr{YType::str, "ATM-ACR"} { yang_name = "ATM-ACRsubinterface"; yang_parent_name = "local-address"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::Default::LocalAddress::ATMACRsubinterface::~ATMACRsubinterface() { } bool Native::Crypto::Keyring::Default::LocalAddress::ATMACRsubinterface::has_data() const { if (is_presence_container) return true; return atm_acr.is_set; } bool Native::Crypto::Keyring::Default::LocalAddress::ATMACRsubinterface::has_operation() const { return is_set(yfilter) || ydk::is_set(atm_acr.yfilter); } std::string Native::Crypto::Keyring::Default::LocalAddress::ATMACRsubinterface::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ATM-ACRsubinterface"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::Default::LocalAddress::ATMACRsubinterface::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (atm_acr.is_set || is_set(atm_acr.yfilter)) leaf_name_data.push_back(atm_acr.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::Default::LocalAddress::ATMACRsubinterface::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::Default::LocalAddress::ATMACRsubinterface::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Keyring::Default::LocalAddress::ATMACRsubinterface::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "ATM-ACR") { atm_acr = value; atm_acr.value_namespace = name_space; atm_acr.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Keyring::Default::LocalAddress::ATMACRsubinterface::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ATM-ACR") { atm_acr.yfilter = yfilter; } } bool Native::Crypto::Keyring::Default::LocalAddress::ATMACRsubinterface::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ATM-ACR") return true; return false; } Native::Crypto::Keyring::Default::LocalAddress::LISPSubinterface::LISPSubinterface() : lisp{YType::str, "LISP"} { yang_name = "LISP-subinterface"; yang_parent_name = "local-address"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::Default::LocalAddress::LISPSubinterface::~LISPSubinterface() { } bool Native::Crypto::Keyring::Default::LocalAddress::LISPSubinterface::has_data() const { if (is_presence_container) return true; return lisp.is_set; } bool Native::Crypto::Keyring::Default::LocalAddress::LISPSubinterface::has_operation() const { return is_set(yfilter) || ydk::is_set(lisp.yfilter); } std::string Native::Crypto::Keyring::Default::LocalAddress::LISPSubinterface::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "LISP-subinterface"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::Default::LocalAddress::LISPSubinterface::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (lisp.is_set || is_set(lisp.yfilter)) leaf_name_data.push_back(lisp.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::Default::LocalAddress::LISPSubinterface::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::Default::LocalAddress::LISPSubinterface::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Keyring::Default::LocalAddress::LISPSubinterface::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "LISP") { lisp = value; lisp.value_namespace = name_space; lisp.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Keyring::Default::LocalAddress::LISPSubinterface::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "LISP") { lisp.yfilter = yfilter; } } bool Native::Crypto::Keyring::Default::LocalAddress::LISPSubinterface::has_leaf_or_child_of_name(const std::string & name) const { if(name == "LISP") return true; return false; } Native::Crypto::Keyring::Default::LocalAddress::PortChannelSubinterface::PortChannelSubinterface() : port_channel{YType::str, "Port-channel"} { yang_name = "Port-channel-subinterface"; yang_parent_name = "local-address"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::Default::LocalAddress::PortChannelSubinterface::~PortChannelSubinterface() { } bool Native::Crypto::Keyring::Default::LocalAddress::PortChannelSubinterface::has_data() const { if (is_presence_container) return true; return port_channel.is_set; } bool Native::Crypto::Keyring::Default::LocalAddress::PortChannelSubinterface::has_operation() const { return is_set(yfilter) || ydk::is_set(port_channel.yfilter); } std::string Native::Crypto::Keyring::Default::LocalAddress::PortChannelSubinterface::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "Port-channel-subinterface"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::Default::LocalAddress::PortChannelSubinterface::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (port_channel.is_set || is_set(port_channel.yfilter)) leaf_name_data.push_back(port_channel.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::Default::LocalAddress::PortChannelSubinterface::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::Default::LocalAddress::PortChannelSubinterface::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Keyring::Default::LocalAddress::PortChannelSubinterface::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "Port-channel") { port_channel = value; port_channel.value_namespace = name_space; port_channel.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Keyring::Default::LocalAddress::PortChannelSubinterface::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "Port-channel") { port_channel.yfilter = yfilter; } } bool Native::Crypto::Keyring::Default::LocalAddress::PortChannelSubinterface::has_leaf_or_child_of_name(const std::string & name) const { if(name == "Port-channel") return true; return false; } Native::Crypto::Keyring::Default::PreSharedKey::PreSharedKey() : address(std::make_shared<Native::Crypto::Keyring::Default::PreSharedKey::Address>()) , hostname(this, {"name"}) { address->parent = this; yang_name = "pre-shared-key"; yang_parent_name = "default"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::Default::PreSharedKey::~PreSharedKey() { } bool Native::Crypto::Keyring::Default::PreSharedKey::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<hostname.len(); index++) { if(hostname[index]->has_data()) return true; } return (address != nullptr && address->has_data()); } bool Native::Crypto::Keyring::Default::PreSharedKey::has_operation() const { for (std::size_t index=0; index<hostname.len(); index++) { if(hostname[index]->has_operation()) return true; } return is_set(yfilter) || (address != nullptr && address->has_operation()); } std::string Native::Crypto::Keyring::Default::PreSharedKey::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "pre-shared-key"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::Default::PreSharedKey::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::Default::PreSharedKey::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "address") { if(address == nullptr) { address = std::make_shared<Native::Crypto::Keyring::Default::PreSharedKey::Address>(); } return address; } if(child_yang_name == "hostname") { auto ent_ = std::make_shared<Native::Crypto::Keyring::Default::PreSharedKey::Hostname>(); ent_->parent = this; hostname.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::Default::PreSharedKey::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(address != nullptr) { _children["address"] = address; } count_ = 0; for (auto ent_ : hostname.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void Native::Crypto::Keyring::Default::PreSharedKey::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Keyring::Default::PreSharedKey::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Keyring::Default::PreSharedKey::has_leaf_or_child_of_name(const std::string & name) const { if(name == "address" || name == "hostname") return true; return false; } Native::Crypto::Keyring::Default::PreSharedKey::Address::Address() : ipv4(this, {"ipv4_addr"}) , ipv6(this, {"ipv6_addr"}) { yang_name = "address"; yang_parent_name = "pre-shared-key"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::Default::PreSharedKey::Address::~Address() { } bool Native::Crypto::Keyring::Default::PreSharedKey::Address::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<ipv4.len(); index++) { if(ipv4[index]->has_data()) return true; } for (std::size_t index=0; index<ipv6.len(); index++) { if(ipv6[index]->has_data()) return true; } return false; } bool Native::Crypto::Keyring::Default::PreSharedKey::Address::has_operation() const { for (std::size_t index=0; index<ipv4.len(); index++) { if(ipv4[index]->has_operation()) return true; } for (std::size_t index=0; index<ipv6.len(); index++) { if(ipv6[index]->has_operation()) return true; } return is_set(yfilter); } std::string Native::Crypto::Keyring::Default::PreSharedKey::Address::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "address"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::Default::PreSharedKey::Address::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::Default::PreSharedKey::Address::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "ipv4") { auto ent_ = std::make_shared<Native::Crypto::Keyring::Default::PreSharedKey::Address::Ipv4>(); ent_->parent = this; ipv4.append(ent_); return ent_; } if(child_yang_name == "ipv6") { auto ent_ = std::make_shared<Native::Crypto::Keyring::Default::PreSharedKey::Address::Ipv6>(); ent_->parent = this; ipv6.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::Default::PreSharedKey::Address::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : ipv4.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } count_ = 0; for (auto ent_ : ipv6.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void Native::Crypto::Keyring::Default::PreSharedKey::Address::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Keyring::Default::PreSharedKey::Address::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Keyring::Default::PreSharedKey::Address::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipv4" || name == "ipv6") return true; return false; } Native::Crypto::Keyring::Default::PreSharedKey::Address::Ipv4::Ipv4() : ipv4_addr{YType::str, "ipv4-addr"}, mask{YType::str, "mask"}, key{YType::empty, "key"}, encryption{YType::enumeration, "encryption"}, unencryt_key{YType::str, "unencryt-key"} { yang_name = "ipv4"; yang_parent_name = "address"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::Default::PreSharedKey::Address::Ipv4::~Ipv4() { } bool Native::Crypto::Keyring::Default::PreSharedKey::Address::Ipv4::has_data() const { if (is_presence_container) return true; return ipv4_addr.is_set || mask.is_set || key.is_set || encryption.is_set || unencryt_key.is_set; } bool Native::Crypto::Keyring::Default::PreSharedKey::Address::Ipv4::has_operation() const { return is_set(yfilter) || ydk::is_set(ipv4_addr.yfilter) || ydk::is_set(mask.yfilter) || ydk::is_set(key.yfilter) || ydk::is_set(encryption.yfilter) || ydk::is_set(unencryt_key.yfilter); } std::string Native::Crypto::Keyring::Default::PreSharedKey::Address::Ipv4::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipv4"; ADD_KEY_TOKEN(ipv4_addr, "ipv4-addr"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::Default::PreSharedKey::Address::Ipv4::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (ipv4_addr.is_set || is_set(ipv4_addr.yfilter)) leaf_name_data.push_back(ipv4_addr.get_name_leafdata()); if (mask.is_set || is_set(mask.yfilter)) leaf_name_data.push_back(mask.get_name_leafdata()); if (key.is_set || is_set(key.yfilter)) leaf_name_data.push_back(key.get_name_leafdata()); if (encryption.is_set || is_set(encryption.yfilter)) leaf_name_data.push_back(encryption.get_name_leafdata()); if (unencryt_key.is_set || is_set(unencryt_key.yfilter)) leaf_name_data.push_back(unencryt_key.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::Default::PreSharedKey::Address::Ipv4::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::Default::PreSharedKey::Address::Ipv4::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Keyring::Default::PreSharedKey::Address::Ipv4::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "ipv4-addr") { ipv4_addr = value; ipv4_addr.value_namespace = name_space; ipv4_addr.value_namespace_prefix = name_space_prefix; } if(value_path == "mask") { mask = value; mask.value_namespace = name_space; mask.value_namespace_prefix = name_space_prefix; } if(value_path == "key") { key = value; key.value_namespace = name_space; key.value_namespace_prefix = name_space_prefix; } if(value_path == "encryption") { encryption = value; encryption.value_namespace = name_space; encryption.value_namespace_prefix = name_space_prefix; } if(value_path == "unencryt-key") { unencryt_key = value; unencryt_key.value_namespace = name_space; unencryt_key.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Keyring::Default::PreSharedKey::Address::Ipv4::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ipv4-addr") { ipv4_addr.yfilter = yfilter; } if(value_path == "mask") { mask.yfilter = yfilter; } if(value_path == "key") { key.yfilter = yfilter; } if(value_path == "encryption") { encryption.yfilter = yfilter; } if(value_path == "unencryt-key") { unencryt_key.yfilter = yfilter; } } bool Native::Crypto::Keyring::Default::PreSharedKey::Address::Ipv4::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipv4-addr" || name == "mask" || name == "key" || name == "encryption" || name == "unencryt-key") return true; return false; } Native::Crypto::Keyring::Default::PreSharedKey::Address::Ipv6::Ipv6() : ipv6_addr{YType::str, "ipv6-addr"}, key{YType::empty, "key"}, encryption{YType::enumeration, "encryption"}, unencryt_key{YType::str, "unencryt-key"} { yang_name = "ipv6"; yang_parent_name = "address"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::Default::PreSharedKey::Address::Ipv6::~Ipv6() { } bool Native::Crypto::Keyring::Default::PreSharedKey::Address::Ipv6::has_data() const { if (is_presence_container) return true; return ipv6_addr.is_set || key.is_set || encryption.is_set || unencryt_key.is_set; } bool Native::Crypto::Keyring::Default::PreSharedKey::Address::Ipv6::has_operation() const { return is_set(yfilter) || ydk::is_set(ipv6_addr.yfilter) || ydk::is_set(key.yfilter) || ydk::is_set(encryption.yfilter) || ydk::is_set(unencryt_key.yfilter); } std::string Native::Crypto::Keyring::Default::PreSharedKey::Address::Ipv6::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipv6"; ADD_KEY_TOKEN(ipv6_addr, "ipv6-addr"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::Default::PreSharedKey::Address::Ipv6::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (ipv6_addr.is_set || is_set(ipv6_addr.yfilter)) leaf_name_data.push_back(ipv6_addr.get_name_leafdata()); if (key.is_set || is_set(key.yfilter)) leaf_name_data.push_back(key.get_name_leafdata()); if (encryption.is_set || is_set(encryption.yfilter)) leaf_name_data.push_back(encryption.get_name_leafdata()); if (unencryt_key.is_set || is_set(unencryt_key.yfilter)) leaf_name_data.push_back(unencryt_key.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::Default::PreSharedKey::Address::Ipv6::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::Default::PreSharedKey::Address::Ipv6::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Keyring::Default::PreSharedKey::Address::Ipv6::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "ipv6-addr") { ipv6_addr = value; ipv6_addr.value_namespace = name_space; ipv6_addr.value_namespace_prefix = name_space_prefix; } if(value_path == "key") { key = value; key.value_namespace = name_space; key.value_namespace_prefix = name_space_prefix; } if(value_path == "encryption") { encryption = value; encryption.value_namespace = name_space; encryption.value_namespace_prefix = name_space_prefix; } if(value_path == "unencryt-key") { unencryt_key = value; unencryt_key.value_namespace = name_space; unencryt_key.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Keyring::Default::PreSharedKey::Address::Ipv6::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ipv6-addr") { ipv6_addr.yfilter = yfilter; } if(value_path == "key") { key.yfilter = yfilter; } if(value_path == "encryption") { encryption.yfilter = yfilter; } if(value_path == "unencryt-key") { unencryt_key.yfilter = yfilter; } } bool Native::Crypto::Keyring::Default::PreSharedKey::Address::Ipv6::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipv6-addr" || name == "key" || name == "encryption" || name == "unencryt-key") return true; return false; } Native::Crypto::Keyring::Default::PreSharedKey::Hostname::Hostname() : name{YType::str, "name"}, key{YType::empty, "key"}, encryption{YType::enumeration, "encryption"}, unencryt_key{YType::str, "unencryt-key"} { yang_name = "hostname"; yang_parent_name = "pre-shared-key"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::Default::PreSharedKey::Hostname::~Hostname() { } bool Native::Crypto::Keyring::Default::PreSharedKey::Hostname::has_data() const { if (is_presence_container) return true; return name.is_set || key.is_set || encryption.is_set || unencryt_key.is_set; } bool Native::Crypto::Keyring::Default::PreSharedKey::Hostname::has_operation() const { return is_set(yfilter) || ydk::is_set(name.yfilter) || ydk::is_set(key.yfilter) || ydk::is_set(encryption.yfilter) || ydk::is_set(unencryt_key.yfilter); } std::string Native::Crypto::Keyring::Default::PreSharedKey::Hostname::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "hostname"; ADD_KEY_TOKEN(name, "name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::Default::PreSharedKey::Hostname::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (name.is_set || is_set(name.yfilter)) leaf_name_data.push_back(name.get_name_leafdata()); if (key.is_set || is_set(key.yfilter)) leaf_name_data.push_back(key.get_name_leafdata()); if (encryption.is_set || is_set(encryption.yfilter)) leaf_name_data.push_back(encryption.get_name_leafdata()); if (unencryt_key.is_set || is_set(unencryt_key.yfilter)) leaf_name_data.push_back(unencryt_key.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::Default::PreSharedKey::Hostname::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::Default::PreSharedKey::Hostname::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Keyring::Default::PreSharedKey::Hostname::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "name") { name = value; name.value_namespace = name_space; name.value_namespace_prefix = name_space_prefix; } if(value_path == "key") { key = value; key.value_namespace = name_space; key.value_namespace_prefix = name_space_prefix; } if(value_path == "encryption") { encryption = value; encryption.value_namespace = name_space; encryption.value_namespace_prefix = name_space_prefix; } if(value_path == "unencryt-key") { unencryt_key = value; unencryt_key.value_namespace = name_space; unencryt_key.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Keyring::Default::PreSharedKey::Hostname::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "name") { name.yfilter = yfilter; } if(value_path == "key") { key.yfilter = yfilter; } if(value_path == "encryption") { encryption.yfilter = yfilter; } if(value_path == "unencryt-key") { unencryt_key.yfilter = yfilter; } } bool Native::Crypto::Keyring::Default::PreSharedKey::Hostname::has_leaf_or_child_of_name(const std::string & name) const { if(name == "name" || name == "key" || name == "encryption" || name == "unencryt-key") return true; return false; } Native::Crypto::Keyring::Default::RsaPubkey::RsaPubkey() : addr(std::make_shared<Native::Crypto::Keyring::Default::RsaPubkey::Addr>()) , hostname(std::make_shared<Native::Crypto::Keyring::Default::RsaPubkey::Hostname>()) { addr->parent = this; hostname->parent = this; yang_name = "rsa-pubkey"; yang_parent_name = "default"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::Default::RsaPubkey::~RsaPubkey() { } bool Native::Crypto::Keyring::Default::RsaPubkey::has_data() const { if (is_presence_container) return true; return (addr != nullptr && addr->has_data()) || (hostname != nullptr && hostname->has_data()); } bool Native::Crypto::Keyring::Default::RsaPubkey::has_operation() const { return is_set(yfilter) || (addr != nullptr && addr->has_operation()) || (hostname != nullptr && hostname->has_operation()); } std::string Native::Crypto::Keyring::Default::RsaPubkey::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "rsa-pubkey"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::Default::RsaPubkey::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::Default::RsaPubkey::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "addr") { if(addr == nullptr) { addr = std::make_shared<Native::Crypto::Keyring::Default::RsaPubkey::Addr>(); } return addr; } if(child_yang_name == "hostname") { if(hostname == nullptr) { hostname = std::make_shared<Native::Crypto::Keyring::Default::RsaPubkey::Hostname>(); } return hostname; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::Default::RsaPubkey::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(addr != nullptr) { _children["addr"] = addr; } if(hostname != nullptr) { _children["hostname"] = hostname; } return _children; } void Native::Crypto::Keyring::Default::RsaPubkey::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Keyring::Default::RsaPubkey::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Keyring::Default::RsaPubkey::has_leaf_or_child_of_name(const std::string & name) const { if(name == "addr" || name == "hostname") return true; return false; } Native::Crypto::Keyring::Default::RsaPubkey::Addr::Addr() : address{YType::str, "address"}, way{YType::enumeration, "way"} { yang_name = "addr"; yang_parent_name = "rsa-pubkey"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::Default::RsaPubkey::Addr::~Addr() { } bool Native::Crypto::Keyring::Default::RsaPubkey::Addr::has_data() const { if (is_presence_container) return true; return address.is_set || way.is_set; } bool Native::Crypto::Keyring::Default::RsaPubkey::Addr::has_operation() const { return is_set(yfilter) || ydk::is_set(address.yfilter) || ydk::is_set(way.yfilter); } std::string Native::Crypto::Keyring::Default::RsaPubkey::Addr::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "addr"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::Default::RsaPubkey::Addr::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (address.is_set || is_set(address.yfilter)) leaf_name_data.push_back(address.get_name_leafdata()); if (way.is_set || is_set(way.yfilter)) leaf_name_data.push_back(way.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::Default::RsaPubkey::Addr::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::Default::RsaPubkey::Addr::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Keyring::Default::RsaPubkey::Addr::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "address") { address = value; address.value_namespace = name_space; address.value_namespace_prefix = name_space_prefix; } if(value_path == "way") { way = value; way.value_namespace = name_space; way.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Keyring::Default::RsaPubkey::Addr::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "address") { address.yfilter = yfilter; } if(value_path == "way") { way.yfilter = yfilter; } } bool Native::Crypto::Keyring::Default::RsaPubkey::Addr::has_leaf_or_child_of_name(const std::string & name) const { if(name == "address" || name == "way") return true; return false; } Native::Crypto::Keyring::Default::RsaPubkey::Hostname::Hostname() : name{YType::str, "name"}, way{YType::enumeration, "way"} { yang_name = "hostname"; yang_parent_name = "rsa-pubkey"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::Default::RsaPubkey::Hostname::~Hostname() { } bool Native::Crypto::Keyring::Default::RsaPubkey::Hostname::has_data() const { if (is_presence_container) return true; return name.is_set || way.is_set; } bool Native::Crypto::Keyring::Default::RsaPubkey::Hostname::has_operation() const { return is_set(yfilter) || ydk::is_set(name.yfilter) || ydk::is_set(way.yfilter); } std::string Native::Crypto::Keyring::Default::RsaPubkey::Hostname::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "hostname"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::Default::RsaPubkey::Hostname::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (name.is_set || is_set(name.yfilter)) leaf_name_data.push_back(name.get_name_leafdata()); if (way.is_set || is_set(way.yfilter)) leaf_name_data.push_back(way.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::Default::RsaPubkey::Hostname::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::Default::RsaPubkey::Hostname::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Keyring::Default::RsaPubkey::Hostname::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "name") { name = value; name.value_namespace = name_space; name.value_namespace_prefix = name_space_prefix; } if(value_path == "way") { way = value; way.value_namespace = name_space; way.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Keyring::Default::RsaPubkey::Hostname::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "name") { name.yfilter = yfilter; } if(value_path == "way") { way.yfilter = yfilter; } } bool Native::Crypto::Keyring::Default::RsaPubkey::Hostname::has_leaf_or_child_of_name(const std::string & name) const { if(name == "name" || name == "way") return true; return false; } Native::Crypto::Keyring::LocalAddress::LocalAddress() : appnav_compress{YType::uint16, "AppNav-Compress"}, appnav_uncompress{YType::uint16, "AppNav-UnCompress"}, atm{YType::str, "ATM"}, atm_acr{YType::str, "ATM-ACR"}, bdi{YType::str, "BDI"}, cem{YType::str, "CEM"}, cem_acr{YType::uint8, "CEM-ACR"}, embedded_service_engine{YType::str, "Embedded-Service-Engine"}, ethernet{YType::str, "Ethernet"}, fastethernet{YType::str, "FastEthernet"}, gigabitethernet{YType::str, "GigabitEthernet"}, fivegigabitethernet{YType::str, "FiveGigabitEthernet"}, twentyfivegige{YType::str, "TwentyFiveGigE"}, twogigabitethernet{YType::str, "TwoGigabitEthernet"}, fortygigabitethernet{YType::str, "FortyGigabitEthernet"}, hundredgige{YType::str, "HundredGigE"}, lisp{YType::str, "LISP"}, loopback{YType::uint32, "Loopback"}, multilink{YType::uint16, "Multilink"}, nve{YType::uint16, "nve"}, overlay{YType::uint16, "overlay"}, port_channel{YType::uint32, "Port-channel"}, pseudowire{YType::uint32, "pseudowire"}, sm{YType::str, "SM"}, cellular{YType::str, "Cellular"}, serial{YType::str, "Serial"}, tengigabitethernet{YType::str, "TenGigabitEthernet"}, tunnel{YType::uint32, "Tunnel"}, virtual_template{YType::uint16, "Virtual-Template"}, vlan{YType::uint16, "Vlan"}, virtualportgroup{YType::uint16, "VirtualPortGroup"}, vasileft{YType::uint16, "vasileft"}, vasiright{YType::uint16, "vasiright"} , bind_ip_address(std::make_shared<Native::Crypto::Keyring::LocalAddress::BindIpAddress>()) , atm_subinterface(std::make_shared<Native::Crypto::Keyring::LocalAddress::ATMSubinterface>()) , atm_acrsubinterface(std::make_shared<Native::Crypto::Keyring::LocalAddress::ATMACRsubinterface>()) , lisp_subinterface(std::make_shared<Native::Crypto::Keyring::LocalAddress::LISPSubinterface>()) , port_channel_subinterface(std::make_shared<Native::Crypto::Keyring::LocalAddress::PortChannelSubinterface>()) { bind_ip_address->parent = this; atm_subinterface->parent = this; atm_acrsubinterface->parent = this; lisp_subinterface->parent = this; port_channel_subinterface->parent = this; yang_name = "local-address"; yang_parent_name = "keyring"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::LocalAddress::~LocalAddress() { } bool Native::Crypto::Keyring::LocalAddress::has_data() const { if (is_presence_container) return true; return appnav_compress.is_set || appnav_uncompress.is_set || atm.is_set || atm_acr.is_set || bdi.is_set || cem.is_set || cem_acr.is_set || embedded_service_engine.is_set || ethernet.is_set || fastethernet.is_set || gigabitethernet.is_set || fivegigabitethernet.is_set || twentyfivegige.is_set || twogigabitethernet.is_set || fortygigabitethernet.is_set || hundredgige.is_set || lisp.is_set || loopback.is_set || multilink.is_set || nve.is_set || overlay.is_set || port_channel.is_set || pseudowire.is_set || sm.is_set || cellular.is_set || serial.is_set || tengigabitethernet.is_set || tunnel.is_set || virtual_template.is_set || vlan.is_set || virtualportgroup.is_set || vasileft.is_set || vasiright.is_set || (bind_ip_address != nullptr && bind_ip_address->has_data()) || (atm_subinterface != nullptr && atm_subinterface->has_data()) || (atm_acrsubinterface != nullptr && atm_acrsubinterface->has_data()) || (lisp_subinterface != nullptr && lisp_subinterface->has_data()) || (port_channel_subinterface != nullptr && port_channel_subinterface->has_data()); } bool Native::Crypto::Keyring::LocalAddress::has_operation() const { return is_set(yfilter) || ydk::is_set(appnav_compress.yfilter) || ydk::is_set(appnav_uncompress.yfilter) || ydk::is_set(atm.yfilter) || ydk::is_set(atm_acr.yfilter) || ydk::is_set(bdi.yfilter) || ydk::is_set(cem.yfilter) || ydk::is_set(cem_acr.yfilter) || ydk::is_set(embedded_service_engine.yfilter) || ydk::is_set(ethernet.yfilter) || ydk::is_set(fastethernet.yfilter) || ydk::is_set(gigabitethernet.yfilter) || ydk::is_set(fivegigabitethernet.yfilter) || ydk::is_set(twentyfivegige.yfilter) || ydk::is_set(twogigabitethernet.yfilter) || ydk::is_set(fortygigabitethernet.yfilter) || ydk::is_set(hundredgige.yfilter) || ydk::is_set(lisp.yfilter) || ydk::is_set(loopback.yfilter) || ydk::is_set(multilink.yfilter) || ydk::is_set(nve.yfilter) || ydk::is_set(overlay.yfilter) || ydk::is_set(port_channel.yfilter) || ydk::is_set(pseudowire.yfilter) || ydk::is_set(sm.yfilter) || ydk::is_set(cellular.yfilter) || ydk::is_set(serial.yfilter) || ydk::is_set(tengigabitethernet.yfilter) || ydk::is_set(tunnel.yfilter) || ydk::is_set(virtual_template.yfilter) || ydk::is_set(vlan.yfilter) || ydk::is_set(virtualportgroup.yfilter) || ydk::is_set(vasileft.yfilter) || ydk::is_set(vasiright.yfilter) || (bind_ip_address != nullptr && bind_ip_address->has_operation()) || (atm_subinterface != nullptr && atm_subinterface->has_operation()) || (atm_acrsubinterface != nullptr && atm_acrsubinterface->has_operation()) || (lisp_subinterface != nullptr && lisp_subinterface->has_operation()) || (port_channel_subinterface != nullptr && port_channel_subinterface->has_operation()); } std::string Native::Crypto::Keyring::LocalAddress::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "local-address"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::LocalAddress::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (appnav_compress.is_set || is_set(appnav_compress.yfilter)) leaf_name_data.push_back(appnav_compress.get_name_leafdata()); if (appnav_uncompress.is_set || is_set(appnav_uncompress.yfilter)) leaf_name_data.push_back(appnav_uncompress.get_name_leafdata()); if (atm.is_set || is_set(atm.yfilter)) leaf_name_data.push_back(atm.get_name_leafdata()); if (atm_acr.is_set || is_set(atm_acr.yfilter)) leaf_name_data.push_back(atm_acr.get_name_leafdata()); if (bdi.is_set || is_set(bdi.yfilter)) leaf_name_data.push_back(bdi.get_name_leafdata()); if (cem.is_set || is_set(cem.yfilter)) leaf_name_data.push_back(cem.get_name_leafdata()); if (cem_acr.is_set || is_set(cem_acr.yfilter)) leaf_name_data.push_back(cem_acr.get_name_leafdata()); if (embedded_service_engine.is_set || is_set(embedded_service_engine.yfilter)) leaf_name_data.push_back(embedded_service_engine.get_name_leafdata()); if (ethernet.is_set || is_set(ethernet.yfilter)) leaf_name_data.push_back(ethernet.get_name_leafdata()); if (fastethernet.is_set || is_set(fastethernet.yfilter)) leaf_name_data.push_back(fastethernet.get_name_leafdata()); if (gigabitethernet.is_set || is_set(gigabitethernet.yfilter)) leaf_name_data.push_back(gigabitethernet.get_name_leafdata()); if (fivegigabitethernet.is_set || is_set(fivegigabitethernet.yfilter)) leaf_name_data.push_back(fivegigabitethernet.get_name_leafdata()); if (twentyfivegige.is_set || is_set(twentyfivegige.yfilter)) leaf_name_data.push_back(twentyfivegige.get_name_leafdata()); if (twogigabitethernet.is_set || is_set(twogigabitethernet.yfilter)) leaf_name_data.push_back(twogigabitethernet.get_name_leafdata()); if (fortygigabitethernet.is_set || is_set(fortygigabitethernet.yfilter)) leaf_name_data.push_back(fortygigabitethernet.get_name_leafdata()); if (hundredgige.is_set || is_set(hundredgige.yfilter)) leaf_name_data.push_back(hundredgige.get_name_leafdata()); if (lisp.is_set || is_set(lisp.yfilter)) leaf_name_data.push_back(lisp.get_name_leafdata()); if (loopback.is_set || is_set(loopback.yfilter)) leaf_name_data.push_back(loopback.get_name_leafdata()); if (multilink.is_set || is_set(multilink.yfilter)) leaf_name_data.push_back(multilink.get_name_leafdata()); if (nve.is_set || is_set(nve.yfilter)) leaf_name_data.push_back(nve.get_name_leafdata()); if (overlay.is_set || is_set(overlay.yfilter)) leaf_name_data.push_back(overlay.get_name_leafdata()); if (port_channel.is_set || is_set(port_channel.yfilter)) leaf_name_data.push_back(port_channel.get_name_leafdata()); if (pseudowire.is_set || is_set(pseudowire.yfilter)) leaf_name_data.push_back(pseudowire.get_name_leafdata()); if (sm.is_set || is_set(sm.yfilter)) leaf_name_data.push_back(sm.get_name_leafdata()); if (cellular.is_set || is_set(cellular.yfilter)) leaf_name_data.push_back(cellular.get_name_leafdata()); if (serial.is_set || is_set(serial.yfilter)) leaf_name_data.push_back(serial.get_name_leafdata()); if (tengigabitethernet.is_set || is_set(tengigabitethernet.yfilter)) leaf_name_data.push_back(tengigabitethernet.get_name_leafdata()); if (tunnel.is_set || is_set(tunnel.yfilter)) leaf_name_data.push_back(tunnel.get_name_leafdata()); if (virtual_template.is_set || is_set(virtual_template.yfilter)) leaf_name_data.push_back(virtual_template.get_name_leafdata()); if (vlan.is_set || is_set(vlan.yfilter)) leaf_name_data.push_back(vlan.get_name_leafdata()); if (virtualportgroup.is_set || is_set(virtualportgroup.yfilter)) leaf_name_data.push_back(virtualportgroup.get_name_leafdata()); if (vasileft.is_set || is_set(vasileft.yfilter)) leaf_name_data.push_back(vasileft.get_name_leafdata()); if (vasiright.is_set || is_set(vasiright.yfilter)) leaf_name_data.push_back(vasiright.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::LocalAddress::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "bind-ip-address") { if(bind_ip_address == nullptr) { bind_ip_address = std::make_shared<Native::Crypto::Keyring::LocalAddress::BindIpAddress>(); } return bind_ip_address; } if(child_yang_name == "ATM-subinterface") { if(atm_subinterface == nullptr) { atm_subinterface = std::make_shared<Native::Crypto::Keyring::LocalAddress::ATMSubinterface>(); } return atm_subinterface; } if(child_yang_name == "ATM-ACRsubinterface") { if(atm_acrsubinterface == nullptr) { atm_acrsubinterface = std::make_shared<Native::Crypto::Keyring::LocalAddress::ATMACRsubinterface>(); } return atm_acrsubinterface; } if(child_yang_name == "LISP-subinterface") { if(lisp_subinterface == nullptr) { lisp_subinterface = std::make_shared<Native::Crypto::Keyring::LocalAddress::LISPSubinterface>(); } return lisp_subinterface; } if(child_yang_name == "Port-channel-subinterface") { if(port_channel_subinterface == nullptr) { port_channel_subinterface = std::make_shared<Native::Crypto::Keyring::LocalAddress::PortChannelSubinterface>(); } return port_channel_subinterface; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::LocalAddress::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(bind_ip_address != nullptr) { _children["bind-ip-address"] = bind_ip_address; } if(atm_subinterface != nullptr) { _children["ATM-subinterface"] = atm_subinterface; } if(atm_acrsubinterface != nullptr) { _children["ATM-ACRsubinterface"] = atm_acrsubinterface; } if(lisp_subinterface != nullptr) { _children["LISP-subinterface"] = lisp_subinterface; } if(port_channel_subinterface != nullptr) { _children["Port-channel-subinterface"] = port_channel_subinterface; } return _children; } void Native::Crypto::Keyring::LocalAddress::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "AppNav-Compress") { appnav_compress = value; appnav_compress.value_namespace = name_space; appnav_compress.value_namespace_prefix = name_space_prefix; } if(value_path == "AppNav-UnCompress") { appnav_uncompress = value; appnav_uncompress.value_namespace = name_space; appnav_uncompress.value_namespace_prefix = name_space_prefix; } if(value_path == "ATM") { atm = value; atm.value_namespace = name_space; atm.value_namespace_prefix = name_space_prefix; } if(value_path == "ATM-ACR") { atm_acr = value; atm_acr.value_namespace = name_space; atm_acr.value_namespace_prefix = name_space_prefix; } if(value_path == "BDI") { bdi = value; bdi.value_namespace = name_space; bdi.value_namespace_prefix = name_space_prefix; } if(value_path == "CEM") { cem = value; cem.value_namespace = name_space; cem.value_namespace_prefix = name_space_prefix; } if(value_path == "CEM-ACR") { cem_acr = value; cem_acr.value_namespace = name_space; cem_acr.value_namespace_prefix = name_space_prefix; } if(value_path == "Embedded-Service-Engine") { embedded_service_engine = value; embedded_service_engine.value_namespace = name_space; embedded_service_engine.value_namespace_prefix = name_space_prefix; } if(value_path == "Ethernet") { ethernet = value; ethernet.value_namespace = name_space; ethernet.value_namespace_prefix = name_space_prefix; } if(value_path == "FastEthernet") { fastethernet = value; fastethernet.value_namespace = name_space; fastethernet.value_namespace_prefix = name_space_prefix; } if(value_path == "GigabitEthernet") { gigabitethernet = value; gigabitethernet.value_namespace = name_space; gigabitethernet.value_namespace_prefix = name_space_prefix; } if(value_path == "FiveGigabitEthernet") { fivegigabitethernet = value; fivegigabitethernet.value_namespace = name_space; fivegigabitethernet.value_namespace_prefix = name_space_prefix; } if(value_path == "TwentyFiveGigE") { twentyfivegige = value; twentyfivegige.value_namespace = name_space; twentyfivegige.value_namespace_prefix = name_space_prefix; } if(value_path == "TwoGigabitEthernet") { twogigabitethernet = value; twogigabitethernet.value_namespace = name_space; twogigabitethernet.value_namespace_prefix = name_space_prefix; } if(value_path == "FortyGigabitEthernet") { fortygigabitethernet = value; fortygigabitethernet.value_namespace = name_space; fortygigabitethernet.value_namespace_prefix = name_space_prefix; } if(value_path == "HundredGigE") { hundredgige = value; hundredgige.value_namespace = name_space; hundredgige.value_namespace_prefix = name_space_prefix; } if(value_path == "LISP") { lisp = value; lisp.value_namespace = name_space; lisp.value_namespace_prefix = name_space_prefix; } if(value_path == "Loopback") { loopback = value; loopback.value_namespace = name_space; loopback.value_namespace_prefix = name_space_prefix; } if(value_path == "Multilink") { multilink = value; multilink.value_namespace = name_space; multilink.value_namespace_prefix = name_space_prefix; } if(value_path == "nve") { nve = value; nve.value_namespace = name_space; nve.value_namespace_prefix = name_space_prefix; } if(value_path == "overlay") { overlay = value; overlay.value_namespace = name_space; overlay.value_namespace_prefix = name_space_prefix; } if(value_path == "Port-channel") { port_channel = value; port_channel.value_namespace = name_space; port_channel.value_namespace_prefix = name_space_prefix; } if(value_path == "pseudowire") { pseudowire = value; pseudowire.value_namespace = name_space; pseudowire.value_namespace_prefix = name_space_prefix; } if(value_path == "SM") { sm = value; sm.value_namespace = name_space; sm.value_namespace_prefix = name_space_prefix; } if(value_path == "Cellular") { cellular = value; cellular.value_namespace = name_space; cellular.value_namespace_prefix = name_space_prefix; } if(value_path == "Serial") { serial = value; serial.value_namespace = name_space; serial.value_namespace_prefix = name_space_prefix; } if(value_path == "TenGigabitEthernet") { tengigabitethernet = value; tengigabitethernet.value_namespace = name_space; tengigabitethernet.value_namespace_prefix = name_space_prefix; } if(value_path == "Tunnel") { tunnel = value; tunnel.value_namespace = name_space; tunnel.value_namespace_prefix = name_space_prefix; } if(value_path == "Virtual-Template") { virtual_template = value; virtual_template.value_namespace = name_space; virtual_template.value_namespace_prefix = name_space_prefix; } if(value_path == "Vlan") { vlan = value; vlan.value_namespace = name_space; vlan.value_namespace_prefix = name_space_prefix; } if(value_path == "VirtualPortGroup") { virtualportgroup = value; virtualportgroup.value_namespace = name_space; virtualportgroup.value_namespace_prefix = name_space_prefix; } if(value_path == "vasileft") { vasileft = value; vasileft.value_namespace = name_space; vasileft.value_namespace_prefix = name_space_prefix; } if(value_path == "vasiright") { vasiright = value; vasiright.value_namespace = name_space; vasiright.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Keyring::LocalAddress::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "AppNav-Compress") { appnav_compress.yfilter = yfilter; } if(value_path == "AppNav-UnCompress") { appnav_uncompress.yfilter = yfilter; } if(value_path == "ATM") { atm.yfilter = yfilter; } if(value_path == "ATM-ACR") { atm_acr.yfilter = yfilter; } if(value_path == "BDI") { bdi.yfilter = yfilter; } if(value_path == "CEM") { cem.yfilter = yfilter; } if(value_path == "CEM-ACR") { cem_acr.yfilter = yfilter; } if(value_path == "Embedded-Service-Engine") { embedded_service_engine.yfilter = yfilter; } if(value_path == "Ethernet") { ethernet.yfilter = yfilter; } if(value_path == "FastEthernet") { fastethernet.yfilter = yfilter; } if(value_path == "GigabitEthernet") { gigabitethernet.yfilter = yfilter; } if(value_path == "FiveGigabitEthernet") { fivegigabitethernet.yfilter = yfilter; } if(value_path == "TwentyFiveGigE") { twentyfivegige.yfilter = yfilter; } if(value_path == "TwoGigabitEthernet") { twogigabitethernet.yfilter = yfilter; } if(value_path == "FortyGigabitEthernet") { fortygigabitethernet.yfilter = yfilter; } if(value_path == "HundredGigE") { hundredgige.yfilter = yfilter; } if(value_path == "LISP") { lisp.yfilter = yfilter; } if(value_path == "Loopback") { loopback.yfilter = yfilter; } if(value_path == "Multilink") { multilink.yfilter = yfilter; } if(value_path == "nve") { nve.yfilter = yfilter; } if(value_path == "overlay") { overlay.yfilter = yfilter; } if(value_path == "Port-channel") { port_channel.yfilter = yfilter; } if(value_path == "pseudowire") { pseudowire.yfilter = yfilter; } if(value_path == "SM") { sm.yfilter = yfilter; } if(value_path == "Cellular") { cellular.yfilter = yfilter; } if(value_path == "Serial") { serial.yfilter = yfilter; } if(value_path == "TenGigabitEthernet") { tengigabitethernet.yfilter = yfilter; } if(value_path == "Tunnel") { tunnel.yfilter = yfilter; } if(value_path == "Virtual-Template") { virtual_template.yfilter = yfilter; } if(value_path == "Vlan") { vlan.yfilter = yfilter; } if(value_path == "VirtualPortGroup") { virtualportgroup.yfilter = yfilter; } if(value_path == "vasileft") { vasileft.yfilter = yfilter; } if(value_path == "vasiright") { vasiright.yfilter = yfilter; } } bool Native::Crypto::Keyring::LocalAddress::has_leaf_or_child_of_name(const std::string & name) const { if(name == "bind-ip-address" || name == "ATM-subinterface" || name == "ATM-ACRsubinterface" || name == "LISP-subinterface" || name == "Port-channel-subinterface" || name == "AppNav-Compress" || name == "AppNav-UnCompress" || name == "ATM" || name == "ATM-ACR" || name == "BDI" || name == "CEM" || name == "CEM-ACR" || name == "Embedded-Service-Engine" || name == "Ethernet" || name == "FastEthernet" || name == "GigabitEthernet" || name == "FiveGigabitEthernet" || name == "TwentyFiveGigE" || name == "TwoGigabitEthernet" || name == "FortyGigabitEthernet" || name == "HundredGigE" || name == "LISP" || name == "Loopback" || name == "Multilink" || name == "nve" || name == "overlay" || name == "Port-channel" || name == "pseudowire" || name == "SM" || name == "Cellular" || name == "Serial" || name == "TenGigabitEthernet" || name == "Tunnel" || name == "Virtual-Template" || name == "Vlan" || name == "VirtualPortGroup" || name == "vasileft" || name == "vasiright") return true; return false; } Native::Crypto::Keyring::LocalAddress::BindIpAddress::BindIpAddress() : ip_address{YType::str, "ip-address"}, vrf{YType::str, "vrf"} { yang_name = "bind-ip-address"; yang_parent_name = "local-address"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::LocalAddress::BindIpAddress::~BindIpAddress() { } bool Native::Crypto::Keyring::LocalAddress::BindIpAddress::has_data() const { if (is_presence_container) return true; return ip_address.is_set || vrf.is_set; } bool Native::Crypto::Keyring::LocalAddress::BindIpAddress::has_operation() const { return is_set(yfilter) || ydk::is_set(ip_address.yfilter) || ydk::is_set(vrf.yfilter); } std::string Native::Crypto::Keyring::LocalAddress::BindIpAddress::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "bind-ip-address"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::LocalAddress::BindIpAddress::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (ip_address.is_set || is_set(ip_address.yfilter)) leaf_name_data.push_back(ip_address.get_name_leafdata()); if (vrf.is_set || is_set(vrf.yfilter)) leaf_name_data.push_back(vrf.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::LocalAddress::BindIpAddress::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::LocalAddress::BindIpAddress::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Keyring::LocalAddress::BindIpAddress::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "ip-address") { ip_address = value; ip_address.value_namespace = name_space; ip_address.value_namespace_prefix = name_space_prefix; } if(value_path == "vrf") { vrf = value; vrf.value_namespace = name_space; vrf.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Keyring::LocalAddress::BindIpAddress::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ip-address") { ip_address.yfilter = yfilter; } if(value_path == "vrf") { vrf.yfilter = yfilter; } } bool Native::Crypto::Keyring::LocalAddress::BindIpAddress::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ip-address" || name == "vrf") return true; return false; } Native::Crypto::Keyring::LocalAddress::ATMSubinterface::ATMSubinterface() : atm{YType::str, "ATM"} { yang_name = "ATM-subinterface"; yang_parent_name = "local-address"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::LocalAddress::ATMSubinterface::~ATMSubinterface() { } bool Native::Crypto::Keyring::LocalAddress::ATMSubinterface::has_data() const { if (is_presence_container) return true; return atm.is_set; } bool Native::Crypto::Keyring::LocalAddress::ATMSubinterface::has_operation() const { return is_set(yfilter) || ydk::is_set(atm.yfilter); } std::string Native::Crypto::Keyring::LocalAddress::ATMSubinterface::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ATM-subinterface"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::LocalAddress::ATMSubinterface::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (atm.is_set || is_set(atm.yfilter)) leaf_name_data.push_back(atm.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::LocalAddress::ATMSubinterface::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::LocalAddress::ATMSubinterface::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Keyring::LocalAddress::ATMSubinterface::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "ATM") { atm = value; atm.value_namespace = name_space; atm.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Keyring::LocalAddress::ATMSubinterface::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ATM") { atm.yfilter = yfilter; } } bool Native::Crypto::Keyring::LocalAddress::ATMSubinterface::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ATM") return true; return false; } Native::Crypto::Keyring::LocalAddress::ATMACRsubinterface::ATMACRsubinterface() : atm_acr{YType::str, "ATM-ACR"} { yang_name = "ATM-ACRsubinterface"; yang_parent_name = "local-address"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::LocalAddress::ATMACRsubinterface::~ATMACRsubinterface() { } bool Native::Crypto::Keyring::LocalAddress::ATMACRsubinterface::has_data() const { if (is_presence_container) return true; return atm_acr.is_set; } bool Native::Crypto::Keyring::LocalAddress::ATMACRsubinterface::has_operation() const { return is_set(yfilter) || ydk::is_set(atm_acr.yfilter); } std::string Native::Crypto::Keyring::LocalAddress::ATMACRsubinterface::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ATM-ACRsubinterface"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::LocalAddress::ATMACRsubinterface::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (atm_acr.is_set || is_set(atm_acr.yfilter)) leaf_name_data.push_back(atm_acr.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::LocalAddress::ATMACRsubinterface::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::LocalAddress::ATMACRsubinterface::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Keyring::LocalAddress::ATMACRsubinterface::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "ATM-ACR") { atm_acr = value; atm_acr.value_namespace = name_space; atm_acr.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Keyring::LocalAddress::ATMACRsubinterface::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ATM-ACR") { atm_acr.yfilter = yfilter; } } bool Native::Crypto::Keyring::LocalAddress::ATMACRsubinterface::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ATM-ACR") return true; return false; } Native::Crypto::Keyring::LocalAddress::LISPSubinterface::LISPSubinterface() : lisp{YType::str, "LISP"} { yang_name = "LISP-subinterface"; yang_parent_name = "local-address"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::LocalAddress::LISPSubinterface::~LISPSubinterface() { } bool Native::Crypto::Keyring::LocalAddress::LISPSubinterface::has_data() const { if (is_presence_container) return true; return lisp.is_set; } bool Native::Crypto::Keyring::LocalAddress::LISPSubinterface::has_operation() const { return is_set(yfilter) || ydk::is_set(lisp.yfilter); } std::string Native::Crypto::Keyring::LocalAddress::LISPSubinterface::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "LISP-subinterface"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::LocalAddress::LISPSubinterface::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (lisp.is_set || is_set(lisp.yfilter)) leaf_name_data.push_back(lisp.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::LocalAddress::LISPSubinterface::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::LocalAddress::LISPSubinterface::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Keyring::LocalAddress::LISPSubinterface::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "LISP") { lisp = value; lisp.value_namespace = name_space; lisp.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Keyring::LocalAddress::LISPSubinterface::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "LISP") { lisp.yfilter = yfilter; } } bool Native::Crypto::Keyring::LocalAddress::LISPSubinterface::has_leaf_or_child_of_name(const std::string & name) const { if(name == "LISP") return true; return false; } Native::Crypto::Keyring::LocalAddress::PortChannelSubinterface::PortChannelSubinterface() : port_channel{YType::str, "Port-channel"} { yang_name = "Port-channel-subinterface"; yang_parent_name = "local-address"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::LocalAddress::PortChannelSubinterface::~PortChannelSubinterface() { } bool Native::Crypto::Keyring::LocalAddress::PortChannelSubinterface::has_data() const { if (is_presence_container) return true; return port_channel.is_set; } bool Native::Crypto::Keyring::LocalAddress::PortChannelSubinterface::has_operation() const { return is_set(yfilter) || ydk::is_set(port_channel.yfilter); } std::string Native::Crypto::Keyring::LocalAddress::PortChannelSubinterface::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "Port-channel-subinterface"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::LocalAddress::PortChannelSubinterface::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (port_channel.is_set || is_set(port_channel.yfilter)) leaf_name_data.push_back(port_channel.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::LocalAddress::PortChannelSubinterface::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::LocalAddress::PortChannelSubinterface::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Keyring::LocalAddress::PortChannelSubinterface::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "Port-channel") { port_channel = value; port_channel.value_namespace = name_space; port_channel.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Keyring::LocalAddress::PortChannelSubinterface::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "Port-channel") { port_channel.yfilter = yfilter; } } bool Native::Crypto::Keyring::LocalAddress::PortChannelSubinterface::has_leaf_or_child_of_name(const std::string & name) const { if(name == "Port-channel") return true; return false; } Native::Crypto::Keyring::PreSharedKey::PreSharedKey() : address(std::make_shared<Native::Crypto::Keyring::PreSharedKey::Address>()) , hostname(this, {"name"}) { address->parent = this; yang_name = "pre-shared-key"; yang_parent_name = "keyring"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::PreSharedKey::~PreSharedKey() { } bool Native::Crypto::Keyring::PreSharedKey::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<hostname.len(); index++) { if(hostname[index]->has_data()) return true; } return (address != nullptr && address->has_data()); } bool Native::Crypto::Keyring::PreSharedKey::has_operation() const { for (std::size_t index=0; index<hostname.len(); index++) { if(hostname[index]->has_operation()) return true; } return is_set(yfilter) || (address != nullptr && address->has_operation()); } std::string Native::Crypto::Keyring::PreSharedKey::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "pre-shared-key"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::PreSharedKey::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::PreSharedKey::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "address") { if(address == nullptr) { address = std::make_shared<Native::Crypto::Keyring::PreSharedKey::Address>(); } return address; } if(child_yang_name == "hostname") { auto ent_ = std::make_shared<Native::Crypto::Keyring::PreSharedKey::Hostname>(); ent_->parent = this; hostname.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::PreSharedKey::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(address != nullptr) { _children["address"] = address; } count_ = 0; for (auto ent_ : hostname.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void Native::Crypto::Keyring::PreSharedKey::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Keyring::PreSharedKey::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Keyring::PreSharedKey::has_leaf_or_child_of_name(const std::string & name) const { if(name == "address" || name == "hostname") return true; return false; } Native::Crypto::Keyring::PreSharedKey::Address::Address() : ipv4(this, {"ipv4_addr"}) , ipv6(this, {"ipv6_addr"}) { yang_name = "address"; yang_parent_name = "pre-shared-key"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::PreSharedKey::Address::~Address() { } bool Native::Crypto::Keyring::PreSharedKey::Address::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<ipv4.len(); index++) { if(ipv4[index]->has_data()) return true; } for (std::size_t index=0; index<ipv6.len(); index++) { if(ipv6[index]->has_data()) return true; } return false; } bool Native::Crypto::Keyring::PreSharedKey::Address::has_operation() const { for (std::size_t index=0; index<ipv4.len(); index++) { if(ipv4[index]->has_operation()) return true; } for (std::size_t index=0; index<ipv6.len(); index++) { if(ipv6[index]->has_operation()) return true; } return is_set(yfilter); } std::string Native::Crypto::Keyring::PreSharedKey::Address::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "address"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::PreSharedKey::Address::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::PreSharedKey::Address::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "ipv4") { auto ent_ = std::make_shared<Native::Crypto::Keyring::PreSharedKey::Address::Ipv4>(); ent_->parent = this; ipv4.append(ent_); return ent_; } if(child_yang_name == "ipv6") { auto ent_ = std::make_shared<Native::Crypto::Keyring::PreSharedKey::Address::Ipv6>(); ent_->parent = this; ipv6.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::PreSharedKey::Address::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : ipv4.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } count_ = 0; for (auto ent_ : ipv6.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void Native::Crypto::Keyring::PreSharedKey::Address::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Keyring::PreSharedKey::Address::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Keyring::PreSharedKey::Address::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipv4" || name == "ipv6") return true; return false; } Native::Crypto::Keyring::PreSharedKey::Address::Ipv4::Ipv4() : ipv4_addr{YType::str, "ipv4-addr"}, mask{YType::str, "mask"}, key{YType::empty, "key"}, encryption{YType::enumeration, "encryption"}, unencryt_key{YType::str, "unencryt-key"} { yang_name = "ipv4"; yang_parent_name = "address"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::PreSharedKey::Address::Ipv4::~Ipv4() { } bool Native::Crypto::Keyring::PreSharedKey::Address::Ipv4::has_data() const { if (is_presence_container) return true; return ipv4_addr.is_set || mask.is_set || key.is_set || encryption.is_set || unencryt_key.is_set; } bool Native::Crypto::Keyring::PreSharedKey::Address::Ipv4::has_operation() const { return is_set(yfilter) || ydk::is_set(ipv4_addr.yfilter) || ydk::is_set(mask.yfilter) || ydk::is_set(key.yfilter) || ydk::is_set(encryption.yfilter) || ydk::is_set(unencryt_key.yfilter); } std::string Native::Crypto::Keyring::PreSharedKey::Address::Ipv4::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipv4"; ADD_KEY_TOKEN(ipv4_addr, "ipv4-addr"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::PreSharedKey::Address::Ipv4::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (ipv4_addr.is_set || is_set(ipv4_addr.yfilter)) leaf_name_data.push_back(ipv4_addr.get_name_leafdata()); if (mask.is_set || is_set(mask.yfilter)) leaf_name_data.push_back(mask.get_name_leafdata()); if (key.is_set || is_set(key.yfilter)) leaf_name_data.push_back(key.get_name_leafdata()); if (encryption.is_set || is_set(encryption.yfilter)) leaf_name_data.push_back(encryption.get_name_leafdata()); if (unencryt_key.is_set || is_set(unencryt_key.yfilter)) leaf_name_data.push_back(unencryt_key.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::PreSharedKey::Address::Ipv4::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::PreSharedKey::Address::Ipv4::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Keyring::PreSharedKey::Address::Ipv4::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "ipv4-addr") { ipv4_addr = value; ipv4_addr.value_namespace = name_space; ipv4_addr.value_namespace_prefix = name_space_prefix; } if(value_path == "mask") { mask = value; mask.value_namespace = name_space; mask.value_namespace_prefix = name_space_prefix; } if(value_path == "key") { key = value; key.value_namespace = name_space; key.value_namespace_prefix = name_space_prefix; } if(value_path == "encryption") { encryption = value; encryption.value_namespace = name_space; encryption.value_namespace_prefix = name_space_prefix; } if(value_path == "unencryt-key") { unencryt_key = value; unencryt_key.value_namespace = name_space; unencryt_key.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Keyring::PreSharedKey::Address::Ipv4::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ipv4-addr") { ipv4_addr.yfilter = yfilter; } if(value_path == "mask") { mask.yfilter = yfilter; } if(value_path == "key") { key.yfilter = yfilter; } if(value_path == "encryption") { encryption.yfilter = yfilter; } if(value_path == "unencryt-key") { unencryt_key.yfilter = yfilter; } } bool Native::Crypto::Keyring::PreSharedKey::Address::Ipv4::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipv4-addr" || name == "mask" || name == "key" || name == "encryption" || name == "unencryt-key") return true; return false; } Native::Crypto::Keyring::PreSharedKey::Address::Ipv6::Ipv6() : ipv6_addr{YType::str, "ipv6-addr"}, key{YType::empty, "key"}, encryption{YType::enumeration, "encryption"}, unencryt_key{YType::str, "unencryt-key"} { yang_name = "ipv6"; yang_parent_name = "address"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::PreSharedKey::Address::Ipv6::~Ipv6() { } bool Native::Crypto::Keyring::PreSharedKey::Address::Ipv6::has_data() const { if (is_presence_container) return true; return ipv6_addr.is_set || key.is_set || encryption.is_set || unencryt_key.is_set; } bool Native::Crypto::Keyring::PreSharedKey::Address::Ipv6::has_operation() const { return is_set(yfilter) || ydk::is_set(ipv6_addr.yfilter) || ydk::is_set(key.yfilter) || ydk::is_set(encryption.yfilter) || ydk::is_set(unencryt_key.yfilter); } std::string Native::Crypto::Keyring::PreSharedKey::Address::Ipv6::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipv6"; ADD_KEY_TOKEN(ipv6_addr, "ipv6-addr"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::PreSharedKey::Address::Ipv6::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (ipv6_addr.is_set || is_set(ipv6_addr.yfilter)) leaf_name_data.push_back(ipv6_addr.get_name_leafdata()); if (key.is_set || is_set(key.yfilter)) leaf_name_data.push_back(key.get_name_leafdata()); if (encryption.is_set || is_set(encryption.yfilter)) leaf_name_data.push_back(encryption.get_name_leafdata()); if (unencryt_key.is_set || is_set(unencryt_key.yfilter)) leaf_name_data.push_back(unencryt_key.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::PreSharedKey::Address::Ipv6::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::PreSharedKey::Address::Ipv6::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Keyring::PreSharedKey::Address::Ipv6::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "ipv6-addr") { ipv6_addr = value; ipv6_addr.value_namespace = name_space; ipv6_addr.value_namespace_prefix = name_space_prefix; } if(value_path == "key") { key = value; key.value_namespace = name_space; key.value_namespace_prefix = name_space_prefix; } if(value_path == "encryption") { encryption = value; encryption.value_namespace = name_space; encryption.value_namespace_prefix = name_space_prefix; } if(value_path == "unencryt-key") { unencryt_key = value; unencryt_key.value_namespace = name_space; unencryt_key.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Keyring::PreSharedKey::Address::Ipv6::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ipv6-addr") { ipv6_addr.yfilter = yfilter; } if(value_path == "key") { key.yfilter = yfilter; } if(value_path == "encryption") { encryption.yfilter = yfilter; } if(value_path == "unencryt-key") { unencryt_key.yfilter = yfilter; } } bool Native::Crypto::Keyring::PreSharedKey::Address::Ipv6::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipv6-addr" || name == "key" || name == "encryption" || name == "unencryt-key") return true; return false; } Native::Crypto::Keyring::PreSharedKey::Hostname::Hostname() : name{YType::str, "name"}, key{YType::empty, "key"}, encryption{YType::enumeration, "encryption"}, unencryt_key{YType::str, "unencryt-key"} { yang_name = "hostname"; yang_parent_name = "pre-shared-key"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::PreSharedKey::Hostname::~Hostname() { } bool Native::Crypto::Keyring::PreSharedKey::Hostname::has_data() const { if (is_presence_container) return true; return name.is_set || key.is_set || encryption.is_set || unencryt_key.is_set; } bool Native::Crypto::Keyring::PreSharedKey::Hostname::has_operation() const { return is_set(yfilter) || ydk::is_set(name.yfilter) || ydk::is_set(key.yfilter) || ydk::is_set(encryption.yfilter) || ydk::is_set(unencryt_key.yfilter); } std::string Native::Crypto::Keyring::PreSharedKey::Hostname::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "hostname"; ADD_KEY_TOKEN(name, "name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::PreSharedKey::Hostname::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (name.is_set || is_set(name.yfilter)) leaf_name_data.push_back(name.get_name_leafdata()); if (key.is_set || is_set(key.yfilter)) leaf_name_data.push_back(key.get_name_leafdata()); if (encryption.is_set || is_set(encryption.yfilter)) leaf_name_data.push_back(encryption.get_name_leafdata()); if (unencryt_key.is_set || is_set(unencryt_key.yfilter)) leaf_name_data.push_back(unencryt_key.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::PreSharedKey::Hostname::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::PreSharedKey::Hostname::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Keyring::PreSharedKey::Hostname::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "name") { name = value; name.value_namespace = name_space; name.value_namespace_prefix = name_space_prefix; } if(value_path == "key") { key = value; key.value_namespace = name_space; key.value_namespace_prefix = name_space_prefix; } if(value_path == "encryption") { encryption = value; encryption.value_namespace = name_space; encryption.value_namespace_prefix = name_space_prefix; } if(value_path == "unencryt-key") { unencryt_key = value; unencryt_key.value_namespace = name_space; unencryt_key.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Keyring::PreSharedKey::Hostname::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "name") { name.yfilter = yfilter; } if(value_path == "key") { key.yfilter = yfilter; } if(value_path == "encryption") { encryption.yfilter = yfilter; } if(value_path == "unencryt-key") { unencryt_key.yfilter = yfilter; } } bool Native::Crypto::Keyring::PreSharedKey::Hostname::has_leaf_or_child_of_name(const std::string & name) const { if(name == "name" || name == "key" || name == "encryption" || name == "unencryt-key") return true; return false; } Native::Crypto::Keyring::RsaPubkey::RsaPubkey() : addr(std::make_shared<Native::Crypto::Keyring::RsaPubkey::Addr>()) , hostname(std::make_shared<Native::Crypto::Keyring::RsaPubkey::Hostname>()) { addr->parent = this; hostname->parent = this; yang_name = "rsa-pubkey"; yang_parent_name = "keyring"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::RsaPubkey::~RsaPubkey() { } bool Native::Crypto::Keyring::RsaPubkey::has_data() const { if (is_presence_container) return true; return (addr != nullptr && addr->has_data()) || (hostname != nullptr && hostname->has_data()); } bool Native::Crypto::Keyring::RsaPubkey::has_operation() const { return is_set(yfilter) || (addr != nullptr && addr->has_operation()) || (hostname != nullptr && hostname->has_operation()); } std::string Native::Crypto::Keyring::RsaPubkey::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "rsa-pubkey"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::RsaPubkey::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::RsaPubkey::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "addr") { if(addr == nullptr) { addr = std::make_shared<Native::Crypto::Keyring::RsaPubkey::Addr>(); } return addr; } if(child_yang_name == "hostname") { if(hostname == nullptr) { hostname = std::make_shared<Native::Crypto::Keyring::RsaPubkey::Hostname>(); } return hostname; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::RsaPubkey::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(addr != nullptr) { _children["addr"] = addr; } if(hostname != nullptr) { _children["hostname"] = hostname; } return _children; } void Native::Crypto::Keyring::RsaPubkey::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Keyring::RsaPubkey::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Keyring::RsaPubkey::has_leaf_or_child_of_name(const std::string & name) const { if(name == "addr" || name == "hostname") return true; return false; } Native::Crypto::Keyring::RsaPubkey::Addr::Addr() : address{YType::str, "address"}, way{YType::enumeration, "way"} { yang_name = "addr"; yang_parent_name = "rsa-pubkey"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::RsaPubkey::Addr::~Addr() { } bool Native::Crypto::Keyring::RsaPubkey::Addr::has_data() const { if (is_presence_container) return true; return address.is_set || way.is_set; } bool Native::Crypto::Keyring::RsaPubkey::Addr::has_operation() const { return is_set(yfilter) || ydk::is_set(address.yfilter) || ydk::is_set(way.yfilter); } std::string Native::Crypto::Keyring::RsaPubkey::Addr::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "addr"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::RsaPubkey::Addr::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (address.is_set || is_set(address.yfilter)) leaf_name_data.push_back(address.get_name_leafdata()); if (way.is_set || is_set(way.yfilter)) leaf_name_data.push_back(way.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::RsaPubkey::Addr::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::RsaPubkey::Addr::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Keyring::RsaPubkey::Addr::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "address") { address = value; address.value_namespace = name_space; address.value_namespace_prefix = name_space_prefix; } if(value_path == "way") { way = value; way.value_namespace = name_space; way.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Keyring::RsaPubkey::Addr::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "address") { address.yfilter = yfilter; } if(value_path == "way") { way.yfilter = yfilter; } } bool Native::Crypto::Keyring::RsaPubkey::Addr::has_leaf_or_child_of_name(const std::string & name) const { if(name == "address" || name == "way") return true; return false; } Native::Crypto::Keyring::RsaPubkey::Hostname::Hostname() : name{YType::str, "name"}, way{YType::enumeration, "way"} { yang_name = "hostname"; yang_parent_name = "rsa-pubkey"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Keyring::RsaPubkey::Hostname::~Hostname() { } bool Native::Crypto::Keyring::RsaPubkey::Hostname::has_data() const { if (is_presence_container) return true; return name.is_set || way.is_set; } bool Native::Crypto::Keyring::RsaPubkey::Hostname::has_operation() const { return is_set(yfilter) || ydk::is_set(name.yfilter) || ydk::is_set(way.yfilter); } std::string Native::Crypto::Keyring::RsaPubkey::Hostname::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "hostname"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Keyring::RsaPubkey::Hostname::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (name.is_set || is_set(name.yfilter)) leaf_name_data.push_back(name.get_name_leafdata()); if (way.is_set || is_set(way.yfilter)) leaf_name_data.push_back(way.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Keyring::RsaPubkey::Hostname::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Keyring::RsaPubkey::Hostname::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Keyring::RsaPubkey::Hostname::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "name") { name = value; name.value_namespace = name_space; name.value_namespace_prefix = name_space_prefix; } if(value_path == "way") { way = value; way.value_namespace = name_space; way.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Keyring::RsaPubkey::Hostname::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "name") { name.yfilter = yfilter; } if(value_path == "way") { way.yfilter = yfilter; } } bool Native::Crypto::Keyring::RsaPubkey::Hostname::has_leaf_or_child_of_name(const std::string & name) const { if(name == "name" || name == "way") return true; return false; } Native::Crypto::Isakmp::Isakmp() : aggressive_mode{YType::enumeration, "aggressive-mode"}, disconnect_revoked_peers{YType::empty, "disconnect-revoked-peers"}, enable{YType::empty, "enable"}, fragmentation{YType::empty, "fragmentation"}, identity{YType::enumeration, "identity"}, invalid_spi_recovery{YType::empty, "invalid-spi-recovery"} , client(std::make_shared<Native::Crypto::Isakmp::Client>()) , default_(std::make_shared<Native::Crypto::Isakmp::Default>()) , keepalive(std::make_shared<Native::Crypto::Isakmp::Keepalive>()) , key(std::make_shared<Native::Crypto::Isakmp::Key>()) , nat(std::make_shared<Native::Crypto::Isakmp::Nat>()) , peer(std::make_shared<Native::Crypto::Isakmp::Peer>()) , policy(this, {"number"}) , profile(this, {"name"}) , xauth(std::make_shared<Native::Crypto::Isakmp::Xauth>()) { client->parent = this; default_->parent = this; keepalive->parent = this; key->parent = this; nat->parent = this; peer->parent = this; xauth->parent = this; yang_name = "isakmp"; yang_parent_name = "crypto"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Isakmp::~Isakmp() { } bool Native::Crypto::Isakmp::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<policy.len(); index++) { if(policy[index]->has_data()) return true; } for (std::size_t index=0; index<profile.len(); index++) { if(profile[index]->has_data()) return true; } return aggressive_mode.is_set || disconnect_revoked_peers.is_set || enable.is_set || fragmentation.is_set || identity.is_set || invalid_spi_recovery.is_set || (client != nullptr && client->has_data()) || (default_ != nullptr && default_->has_data()) || (keepalive != nullptr && keepalive->has_data()) || (key != nullptr && key->has_data()) || (nat != nullptr && nat->has_data()) || (peer != nullptr && peer->has_data()) || (xauth != nullptr && xauth->has_data()); } bool Native::Crypto::Isakmp::has_operation() const { for (std::size_t index=0; index<policy.len(); index++) { if(policy[index]->has_operation()) return true; } for (std::size_t index=0; index<profile.len(); index++) { if(profile[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(aggressive_mode.yfilter) || ydk::is_set(disconnect_revoked_peers.yfilter) || ydk::is_set(enable.yfilter) || ydk::is_set(fragmentation.yfilter) || ydk::is_set(identity.yfilter) || ydk::is_set(invalid_spi_recovery.yfilter) || (client != nullptr && client->has_operation()) || (default_ != nullptr && default_->has_operation()) || (keepalive != nullptr && keepalive->has_operation()) || (key != nullptr && key->has_operation()) || (nat != nullptr && nat->has_operation()) || (peer != nullptr && peer->has_operation()) || (xauth != nullptr && xauth->has_operation()); } std::string Native::Crypto::Isakmp::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Isakmp::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-crypto:isakmp"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (aggressive_mode.is_set || is_set(aggressive_mode.yfilter)) leaf_name_data.push_back(aggressive_mode.get_name_leafdata()); if (disconnect_revoked_peers.is_set || is_set(disconnect_revoked_peers.yfilter)) leaf_name_data.push_back(disconnect_revoked_peers.get_name_leafdata()); if (enable.is_set || is_set(enable.yfilter)) leaf_name_data.push_back(enable.get_name_leafdata()); if (fragmentation.is_set || is_set(fragmentation.yfilter)) leaf_name_data.push_back(fragmentation.get_name_leafdata()); if (identity.is_set || is_set(identity.yfilter)) leaf_name_data.push_back(identity.get_name_leafdata()); if (invalid_spi_recovery.is_set || is_set(invalid_spi_recovery.yfilter)) leaf_name_data.push_back(invalid_spi_recovery.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "client") { if(client == nullptr) { client = std::make_shared<Native::Crypto::Isakmp::Client>(); } return client; } if(child_yang_name == "default") { if(default_ == nullptr) { default_ = std::make_shared<Native::Crypto::Isakmp::Default>(); } return default_; } if(child_yang_name == "keepalive") { if(keepalive == nullptr) { keepalive = std::make_shared<Native::Crypto::Isakmp::Keepalive>(); } return keepalive; } if(child_yang_name == "key") { if(key == nullptr) { key = std::make_shared<Native::Crypto::Isakmp::Key>(); } return key; } if(child_yang_name == "nat") { if(nat == nullptr) { nat = std::make_shared<Native::Crypto::Isakmp::Nat>(); } return nat; } if(child_yang_name == "peer") { if(peer == nullptr) { peer = std::make_shared<Native::Crypto::Isakmp::Peer>(); } return peer; } if(child_yang_name == "policy") { auto ent_ = std::make_shared<Native::Crypto::Isakmp::Policy>(); ent_->parent = this; policy.append(ent_); return ent_; } if(child_yang_name == "profile") { auto ent_ = std::make_shared<Native::Crypto::Isakmp::Profile>(); ent_->parent = this; profile.append(ent_); return ent_; } if(child_yang_name == "xauth") { if(xauth == nullptr) { xauth = std::make_shared<Native::Crypto::Isakmp::Xauth>(); } return xauth; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(client != nullptr) { _children["client"] = client; } if(default_ != nullptr) { _children["default"] = default_; } if(keepalive != nullptr) { _children["keepalive"] = keepalive; } if(key != nullptr) { _children["key"] = key; } if(nat != nullptr) { _children["nat"] = nat; } if(peer != nullptr) { _children["peer"] = peer; } count_ = 0; for (auto ent_ : policy.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } count_ = 0; for (auto ent_ : profile.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } if(xauth != nullptr) { _children["xauth"] = xauth; } return _children; } void Native::Crypto::Isakmp::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "aggressive-mode") { aggressive_mode = value; aggressive_mode.value_namespace = name_space; aggressive_mode.value_namespace_prefix = name_space_prefix; } if(value_path == "disconnect-revoked-peers") { disconnect_revoked_peers = value; disconnect_revoked_peers.value_namespace = name_space; disconnect_revoked_peers.value_namespace_prefix = name_space_prefix; } if(value_path == "enable") { enable = value; enable.value_namespace = name_space; enable.value_namespace_prefix = name_space_prefix; } if(value_path == "fragmentation") { fragmentation = value; fragmentation.value_namespace = name_space; fragmentation.value_namespace_prefix = name_space_prefix; } if(value_path == "identity") { identity = value; identity.value_namespace = name_space; identity.value_namespace_prefix = name_space_prefix; } if(value_path == "invalid-spi-recovery") { invalid_spi_recovery = value; invalid_spi_recovery.value_namespace = name_space; invalid_spi_recovery.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "aggressive-mode") { aggressive_mode.yfilter = yfilter; } if(value_path == "disconnect-revoked-peers") { disconnect_revoked_peers.yfilter = yfilter; } if(value_path == "enable") { enable.yfilter = yfilter; } if(value_path == "fragmentation") { fragmentation.yfilter = yfilter; } if(value_path == "identity") { identity.yfilter = yfilter; } if(value_path == "invalid-spi-recovery") { invalid_spi_recovery.yfilter = yfilter; } } bool Native::Crypto::Isakmp::has_leaf_or_child_of_name(const std::string & name) const { if(name == "client" || name == "default" || name == "keepalive" || name == "key" || name == "nat" || name == "peer" || name == "policy" || name == "profile" || name == "xauth" || name == "aggressive-mode" || name == "disconnect-revoked-peers" || name == "enable" || name == "fragmentation" || name == "identity" || name == "invalid-spi-recovery") return true; return false; } Native::Crypto::Isakmp::Client::Client() : configuration(std::make_shared<Native::Crypto::Isakmp::Client::Configuration>()) , firewall(this, {"policy_name"}) { configuration->parent = this; yang_name = "client"; yang_parent_name = "isakmp"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Isakmp::Client::~Client() { } bool Native::Crypto::Isakmp::Client::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<firewall.len(); index++) { if(firewall[index]->has_data()) return true; } return (configuration != nullptr && configuration->has_data()); } bool Native::Crypto::Isakmp::Client::has_operation() const { for (std::size_t index=0; index<firewall.len(); index++) { if(firewall[index]->has_operation()) return true; } return is_set(yfilter) || (configuration != nullptr && configuration->has_operation()); } std::string Native::Crypto::Isakmp::Client::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:isakmp/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Isakmp::Client::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "client"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Client::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Client::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "configuration") { if(configuration == nullptr) { configuration = std::make_shared<Native::Crypto::Isakmp::Client::Configuration>(); } return configuration; } if(child_yang_name == "firewall") { auto ent_ = std::make_shared<Native::Crypto::Isakmp::Client::Firewall>(); ent_->parent = this; firewall.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Client::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(configuration != nullptr) { _children["configuration"] = configuration; } count_ = 0; for (auto ent_ : firewall.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void Native::Crypto::Isakmp::Client::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Isakmp::Client::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Isakmp::Client::has_leaf_or_child_of_name(const std::string & name) const { if(name == "configuration" || name == "firewall") return true; return false; } Native::Crypto::Isakmp::Client::Configuration::Configuration() : browser_proxy{YType::str, "browser-proxy"} , address_pool(std::make_shared<Native::Crypto::Isakmp::Client::Configuration::AddressPool>()) , group(this, {"name"}) { address_pool->parent = this; yang_name = "configuration"; yang_parent_name = "client"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Isakmp::Client::Configuration::~Configuration() { } bool Native::Crypto::Isakmp::Client::Configuration::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<group.len(); index++) { if(group[index]->has_data()) return true; } return browser_proxy.is_set || (address_pool != nullptr && address_pool->has_data()); } bool Native::Crypto::Isakmp::Client::Configuration::has_operation() const { for (std::size_t index=0; index<group.len(); index++) { if(group[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(browser_proxy.yfilter) || (address_pool != nullptr && address_pool->has_operation()); } std::string Native::Crypto::Isakmp::Client::Configuration::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:isakmp/client/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Isakmp::Client::Configuration::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "configuration"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Client::Configuration::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (browser_proxy.is_set || is_set(browser_proxy.yfilter)) leaf_name_data.push_back(browser_proxy.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Client::Configuration::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "address-pool") { if(address_pool == nullptr) { address_pool = std::make_shared<Native::Crypto::Isakmp::Client::Configuration::AddressPool>(); } return address_pool; } if(child_yang_name == "group") { auto ent_ = std::make_shared<Native::Crypto::Isakmp::Client::Configuration::Group>(); ent_->parent = this; group.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Client::Configuration::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(address_pool != nullptr) { _children["address-pool"] = address_pool; } count_ = 0; for (auto ent_ : group.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void Native::Crypto::Isakmp::Client::Configuration::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "browser-proxy") { browser_proxy = value; browser_proxy.value_namespace = name_space; browser_proxy.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Client::Configuration::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "browser-proxy") { browser_proxy.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Client::Configuration::has_leaf_or_child_of_name(const std::string & name) const { if(name == "address-pool" || name == "group" || name == "browser-proxy") return true; return false; } Native::Crypto::Isakmp::Client::Configuration::AddressPool::AddressPool() : local{YType::str, "local"} { yang_name = "address-pool"; yang_parent_name = "configuration"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Isakmp::Client::Configuration::AddressPool::~AddressPool() { } bool Native::Crypto::Isakmp::Client::Configuration::AddressPool::has_data() const { if (is_presence_container) return true; return local.is_set; } bool Native::Crypto::Isakmp::Client::Configuration::AddressPool::has_operation() const { return is_set(yfilter) || ydk::is_set(local.yfilter); } std::string Native::Crypto::Isakmp::Client::Configuration::AddressPool::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:isakmp/client/configuration/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Isakmp::Client::Configuration::AddressPool::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "address-pool"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Client::Configuration::AddressPool::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (local.is_set || is_set(local.yfilter)) leaf_name_data.push_back(local.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Client::Configuration::AddressPool::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Client::Configuration::AddressPool::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Client::Configuration::AddressPool::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "local") { local = value; local.value_namespace = name_space; local.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Client::Configuration::AddressPool::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "local") { local.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Client::Configuration::AddressPool::has_leaf_or_child_of_name(const std::string & name) const { if(name == "local") return true; return false; } Native::Crypto::Isakmp::Client::Configuration::Group::Group() : name{YType::str, "name"}, access_restrict{YType::str, "access-restrict"}, acl{YType::str, "acl"}, backup_gateway{YType::str, "backup-gateway"}, browser_proxy{YType::str, "browser-proxy"}, domain{YType::str, "domain"}, group_lock{YType::empty, "group-lock"}, include_local_lan{YType::empty, "include-local-lan"}, max_logins{YType::uint8, "max-logins"}, max_users{YType::uint32, "max-users"}, netmask{YType::str, "netmask"}, pfs{YType::empty, "pfs"}, pool{YType::str, "pool"}, save_password{YType::empty, "save-password"}, smartcard_removal_disconnect{YType::empty, "smartcard-removal-disconnect"}, split_dns{YType::str, "split-dns"} , auto_update(std::make_shared<Native::Crypto::Isakmp::Client::Configuration::Group::AutoUpdate>()) , configuration(std::make_shared<Native::Crypto::Isakmp::Client::Configuration::Group::Configuration_>()) , crypto(std::make_shared<Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_>()) , dhcp(std::make_shared<Native::Crypto::Isakmp::Client::Configuration::Group::Dhcp>()) , dns(std::make_shared<Native::Crypto::Isakmp::Client::Configuration::Group::Dns>()) , firewall(std::make_shared<Native::Crypto::Isakmp::Client::Configuration::Group::Firewall>()) , key(std::make_shared<Native::Crypto::Isakmp::Client::Configuration::Group::Key>()) , wins(std::make_shared<Native::Crypto::Isakmp::Client::Configuration::Group::Wins>()) { auto_update->parent = this; configuration->parent = this; crypto->parent = this; dhcp->parent = this; dns->parent = this; firewall->parent = this; key->parent = this; wins->parent = this; yang_name = "group"; yang_parent_name = "configuration"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Isakmp::Client::Configuration::Group::~Group() { } bool Native::Crypto::Isakmp::Client::Configuration::Group::has_data() const { if (is_presence_container) return true; return name.is_set || access_restrict.is_set || acl.is_set || backup_gateway.is_set || browser_proxy.is_set || domain.is_set || group_lock.is_set || include_local_lan.is_set || max_logins.is_set || max_users.is_set || netmask.is_set || pfs.is_set || pool.is_set || save_password.is_set || smartcard_removal_disconnect.is_set || split_dns.is_set || (auto_update != nullptr && auto_update->has_data()) || (configuration != nullptr && configuration->has_data()) || (crypto != nullptr && crypto->has_data()) || (dhcp != nullptr && dhcp->has_data()) || (dns != nullptr && dns->has_data()) || (firewall != nullptr && firewall->has_data()) || (key != nullptr && key->has_data()) || (wins != nullptr && wins->has_data()); } bool Native::Crypto::Isakmp::Client::Configuration::Group::has_operation() const { return is_set(yfilter) || ydk::is_set(name.yfilter) || ydk::is_set(access_restrict.yfilter) || ydk::is_set(acl.yfilter) || ydk::is_set(backup_gateway.yfilter) || ydk::is_set(browser_proxy.yfilter) || ydk::is_set(domain.yfilter) || ydk::is_set(group_lock.yfilter) || ydk::is_set(include_local_lan.yfilter) || ydk::is_set(max_logins.yfilter) || ydk::is_set(max_users.yfilter) || ydk::is_set(netmask.yfilter) || ydk::is_set(pfs.yfilter) || ydk::is_set(pool.yfilter) || ydk::is_set(save_password.yfilter) || ydk::is_set(smartcard_removal_disconnect.yfilter) || ydk::is_set(split_dns.yfilter) || (auto_update != nullptr && auto_update->has_operation()) || (configuration != nullptr && configuration->has_operation()) || (crypto != nullptr && crypto->has_operation()) || (dhcp != nullptr && dhcp->has_operation()) || (dns != nullptr && dns->has_operation()) || (firewall != nullptr && firewall->has_operation()) || (key != nullptr && key->has_operation()) || (wins != nullptr && wins->has_operation()); } std::string Native::Crypto::Isakmp::Client::Configuration::Group::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:isakmp/client/configuration/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Isakmp::Client::Configuration::Group::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "group"; ADD_KEY_TOKEN(name, "name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Client::Configuration::Group::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (name.is_set || is_set(name.yfilter)) leaf_name_data.push_back(name.get_name_leafdata()); if (access_restrict.is_set || is_set(access_restrict.yfilter)) leaf_name_data.push_back(access_restrict.get_name_leafdata()); if (acl.is_set || is_set(acl.yfilter)) leaf_name_data.push_back(acl.get_name_leafdata()); if (backup_gateway.is_set || is_set(backup_gateway.yfilter)) leaf_name_data.push_back(backup_gateway.get_name_leafdata()); if (browser_proxy.is_set || is_set(browser_proxy.yfilter)) leaf_name_data.push_back(browser_proxy.get_name_leafdata()); if (domain.is_set || is_set(domain.yfilter)) leaf_name_data.push_back(domain.get_name_leafdata()); if (group_lock.is_set || is_set(group_lock.yfilter)) leaf_name_data.push_back(group_lock.get_name_leafdata()); if (include_local_lan.is_set || is_set(include_local_lan.yfilter)) leaf_name_data.push_back(include_local_lan.get_name_leafdata()); if (max_logins.is_set || is_set(max_logins.yfilter)) leaf_name_data.push_back(max_logins.get_name_leafdata()); if (max_users.is_set || is_set(max_users.yfilter)) leaf_name_data.push_back(max_users.get_name_leafdata()); if (netmask.is_set || is_set(netmask.yfilter)) leaf_name_data.push_back(netmask.get_name_leafdata()); if (pfs.is_set || is_set(pfs.yfilter)) leaf_name_data.push_back(pfs.get_name_leafdata()); if (pool.is_set || is_set(pool.yfilter)) leaf_name_data.push_back(pool.get_name_leafdata()); if (save_password.is_set || is_set(save_password.yfilter)) leaf_name_data.push_back(save_password.get_name_leafdata()); if (smartcard_removal_disconnect.is_set || is_set(smartcard_removal_disconnect.yfilter)) leaf_name_data.push_back(smartcard_removal_disconnect.get_name_leafdata()); if (split_dns.is_set || is_set(split_dns.yfilter)) leaf_name_data.push_back(split_dns.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Client::Configuration::Group::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "auto-update") { if(auto_update == nullptr) { auto_update = std::make_shared<Native::Crypto::Isakmp::Client::Configuration::Group::AutoUpdate>(); } return auto_update; } if(child_yang_name == "configuration") { if(configuration == nullptr) { configuration = std::make_shared<Native::Crypto::Isakmp::Client::Configuration::Group::Configuration_>(); } return configuration; } if(child_yang_name == "crypto") { if(crypto == nullptr) { crypto = std::make_shared<Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_>(); } return crypto; } if(child_yang_name == "dhcp") { if(dhcp == nullptr) { dhcp = std::make_shared<Native::Crypto::Isakmp::Client::Configuration::Group::Dhcp>(); } return dhcp; } if(child_yang_name == "dns") { if(dns == nullptr) { dns = std::make_shared<Native::Crypto::Isakmp::Client::Configuration::Group::Dns>(); } return dns; } if(child_yang_name == "firewall") { if(firewall == nullptr) { firewall = std::make_shared<Native::Crypto::Isakmp::Client::Configuration::Group::Firewall>(); } return firewall; } if(child_yang_name == "key") { if(key == nullptr) { key = std::make_shared<Native::Crypto::Isakmp::Client::Configuration::Group::Key>(); } return key; } if(child_yang_name == "wins") { if(wins == nullptr) { wins = std::make_shared<Native::Crypto::Isakmp::Client::Configuration::Group::Wins>(); } return wins; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Client::Configuration::Group::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(auto_update != nullptr) { _children["auto-update"] = auto_update; } if(configuration != nullptr) { _children["configuration"] = configuration; } if(crypto != nullptr) { _children["crypto"] = crypto; } if(dhcp != nullptr) { _children["dhcp"] = dhcp; } if(dns != nullptr) { _children["dns"] = dns; } if(firewall != nullptr) { _children["firewall"] = firewall; } if(key != nullptr) { _children["key"] = key; } if(wins != nullptr) { _children["wins"] = wins; } return _children; } void Native::Crypto::Isakmp::Client::Configuration::Group::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "name") { name = value; name.value_namespace = name_space; name.value_namespace_prefix = name_space_prefix; } if(value_path == "access-restrict") { access_restrict = value; access_restrict.value_namespace = name_space; access_restrict.value_namespace_prefix = name_space_prefix; } if(value_path == "acl") { acl = value; acl.value_namespace = name_space; acl.value_namespace_prefix = name_space_prefix; } if(value_path == "backup-gateway") { backup_gateway = value; backup_gateway.value_namespace = name_space; backup_gateway.value_namespace_prefix = name_space_prefix; } if(value_path == "browser-proxy") { browser_proxy = value; browser_proxy.value_namespace = name_space; browser_proxy.value_namespace_prefix = name_space_prefix; } if(value_path == "domain") { domain = value; domain.value_namespace = name_space; domain.value_namespace_prefix = name_space_prefix; } if(value_path == "group-lock") { group_lock = value; group_lock.value_namespace = name_space; group_lock.value_namespace_prefix = name_space_prefix; } if(value_path == "include-local-lan") { include_local_lan = value; include_local_lan.value_namespace = name_space; include_local_lan.value_namespace_prefix = name_space_prefix; } if(value_path == "max-logins") { max_logins = value; max_logins.value_namespace = name_space; max_logins.value_namespace_prefix = name_space_prefix; } if(value_path == "max-users") { max_users = value; max_users.value_namespace = name_space; max_users.value_namespace_prefix = name_space_prefix; } if(value_path == "netmask") { netmask = value; netmask.value_namespace = name_space; netmask.value_namespace_prefix = name_space_prefix; } if(value_path == "pfs") { pfs = value; pfs.value_namespace = name_space; pfs.value_namespace_prefix = name_space_prefix; } if(value_path == "pool") { pool = value; pool.value_namespace = name_space; pool.value_namespace_prefix = name_space_prefix; } if(value_path == "save-password") { save_password = value; save_password.value_namespace = name_space; save_password.value_namespace_prefix = name_space_prefix; } if(value_path == "smartcard-removal-disconnect") { smartcard_removal_disconnect = value; smartcard_removal_disconnect.value_namespace = name_space; smartcard_removal_disconnect.value_namespace_prefix = name_space_prefix; } if(value_path == "split-dns") { split_dns = value; split_dns.value_namespace = name_space; split_dns.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Client::Configuration::Group::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "name") { name.yfilter = yfilter; } if(value_path == "access-restrict") { access_restrict.yfilter = yfilter; } if(value_path == "acl") { acl.yfilter = yfilter; } if(value_path == "backup-gateway") { backup_gateway.yfilter = yfilter; } if(value_path == "browser-proxy") { browser_proxy.yfilter = yfilter; } if(value_path == "domain") { domain.yfilter = yfilter; } if(value_path == "group-lock") { group_lock.yfilter = yfilter; } if(value_path == "include-local-lan") { include_local_lan.yfilter = yfilter; } if(value_path == "max-logins") { max_logins.yfilter = yfilter; } if(value_path == "max-users") { max_users.yfilter = yfilter; } if(value_path == "netmask") { netmask.yfilter = yfilter; } if(value_path == "pfs") { pfs.yfilter = yfilter; } if(value_path == "pool") { pool.yfilter = yfilter; } if(value_path == "save-password") { save_password.yfilter = yfilter; } if(value_path == "smartcard-removal-disconnect") { smartcard_removal_disconnect.yfilter = yfilter; } if(value_path == "split-dns") { split_dns.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Client::Configuration::Group::has_leaf_or_child_of_name(const std::string & name) const { if(name == "auto-update" || name == "configuration" || name == "crypto" || name == "dhcp" || name == "dns" || name == "firewall" || name == "key" || name == "wins" || name == "name" || name == "access-restrict" || name == "acl" || name == "backup-gateway" || name == "browser-proxy" || name == "domain" || name == "group-lock" || name == "include-local-lan" || name == "max-logins" || name == "max-users" || name == "netmask" || name == "pfs" || name == "pool" || name == "save-password" || name == "smartcard-removal-disconnect" || name == "split-dns") return true; return false; } Native::Crypto::Isakmp::Client::Configuration::Group::AutoUpdate::AutoUpdate() : client{YType::str, "client"}, url{YType::str, "url"}, rev{YType::str, "rev"} { yang_name = "auto-update"; yang_parent_name = "group"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Client::Configuration::Group::AutoUpdate::~AutoUpdate() { } bool Native::Crypto::Isakmp::Client::Configuration::Group::AutoUpdate::has_data() const { if (is_presence_container) return true; return client.is_set || url.is_set || rev.is_set; } bool Native::Crypto::Isakmp::Client::Configuration::Group::AutoUpdate::has_operation() const { return is_set(yfilter) || ydk::is_set(client.yfilter) || ydk::is_set(url.yfilter) || ydk::is_set(rev.yfilter); } std::string Native::Crypto::Isakmp::Client::Configuration::Group::AutoUpdate::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "auto-update"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Client::Configuration::Group::AutoUpdate::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (client.is_set || is_set(client.yfilter)) leaf_name_data.push_back(client.get_name_leafdata()); if (url.is_set || is_set(url.yfilter)) leaf_name_data.push_back(url.get_name_leafdata()); if (rev.is_set || is_set(rev.yfilter)) leaf_name_data.push_back(rev.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Client::Configuration::Group::AutoUpdate::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Client::Configuration::Group::AutoUpdate::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Client::Configuration::Group::AutoUpdate::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "client") { client = value; client.value_namespace = name_space; client.value_namespace_prefix = name_space_prefix; } if(value_path == "url") { url = value; url.value_namespace = name_space; url.value_namespace_prefix = name_space_prefix; } if(value_path == "rev") { rev = value; rev.value_namespace = name_space; rev.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Client::Configuration::Group::AutoUpdate::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "client") { client.yfilter = yfilter; } if(value_path == "url") { url.yfilter = yfilter; } if(value_path == "rev") { rev.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Client::Configuration::Group::AutoUpdate::has_leaf_or_child_of_name(const std::string & name) const { if(name == "client" || name == "url" || name == "rev") return true; return false; } Native::Crypto::Isakmp::Client::Configuration::Group::Configuration_::Configuration_() : url{YType::enumeration, "url"}, version{YType::uint32, "version"} { yang_name = "configuration"; yang_parent_name = "group"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Client::Configuration::Group::Configuration_::~Configuration_() { } bool Native::Crypto::Isakmp::Client::Configuration::Group::Configuration_::has_data() const { if (is_presence_container) return true; return url.is_set || version.is_set; } bool Native::Crypto::Isakmp::Client::Configuration::Group::Configuration_::has_operation() const { return is_set(yfilter) || ydk::is_set(url.yfilter) || ydk::is_set(version.yfilter); } std::string Native::Crypto::Isakmp::Client::Configuration::Group::Configuration_::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "configuration"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Client::Configuration::Group::Configuration_::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (url.is_set || is_set(url.yfilter)) leaf_name_data.push_back(url.get_name_leafdata()); if (version.is_set || is_set(version.yfilter)) leaf_name_data.push_back(version.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Client::Configuration::Group::Configuration_::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Client::Configuration::Group::Configuration_::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Client::Configuration::Group::Configuration_::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "url") { url = value; url.value_namespace = name_space; url.value_namespace_prefix = name_space_prefix; } if(value_path == "version") { version = value; version.value_namespace = name_space; version.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Client::Configuration::Group::Configuration_::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "url") { url.yfilter = yfilter; } if(value_path == "version") { version.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Client::Configuration::Group::Configuration_::has_leaf_or_child_of_name(const std::string & name) const { if(name == "url" || name == "version") return true; return false; } Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::Crypto_() : aaa(std::make_shared<Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::Aaa>()) { aaa->parent = this; yang_name = "crypto"; yang_parent_name = "group"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::~Crypto_() { } bool Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::has_data() const { if (is_presence_container) return true; return (aaa != nullptr && aaa->has_data()); } bool Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::has_operation() const { return is_set(yfilter) || (aaa != nullptr && aaa->has_operation()); } std::string Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "crypto"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "aaa") { if(aaa == nullptr) { aaa = std::make_shared<Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::Aaa>(); } return aaa; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(aaa != nullptr) { _children["aaa"] = aaa; } return _children; } void Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::has_leaf_or_child_of_name(const std::string & name) const { if(name == "aaa") return true; return false; } Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::Aaa::Aaa() : attribute(std::make_shared<Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::Aaa::Attribute>()) { attribute->parent = this; yang_name = "aaa"; yang_parent_name = "crypto"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::Aaa::~Aaa() { } bool Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::Aaa::has_data() const { if (is_presence_container) return true; return (attribute != nullptr && attribute->has_data()); } bool Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::Aaa::has_operation() const { return is_set(yfilter) || (attribute != nullptr && attribute->has_operation()); } std::string Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::Aaa::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "aaa"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::Aaa::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::Aaa::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "attribute") { if(attribute == nullptr) { attribute = std::make_shared<Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::Aaa::Attribute>(); } return attribute; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::Aaa::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(attribute != nullptr) { _children["attribute"] = attribute; } return _children; } void Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::Aaa::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::Aaa::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::Aaa::has_leaf_or_child_of_name(const std::string & name) const { if(name == "attribute") return true; return false; } Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::Aaa::Attribute::Attribute() : list{YType::str, "list"} { yang_name = "attribute"; yang_parent_name = "aaa"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::Aaa::Attribute::~Attribute() { } bool Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::Aaa::Attribute::has_data() const { if (is_presence_container) return true; return list.is_set; } bool Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::Aaa::Attribute::has_operation() const { return is_set(yfilter) || ydk::is_set(list.yfilter); } std::string Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::Aaa::Attribute::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "attribute"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::Aaa::Attribute::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (list.is_set || is_set(list.yfilter)) leaf_name_data.push_back(list.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::Aaa::Attribute::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::Aaa::Attribute::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::Aaa::Attribute::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "list") { list = value; list.value_namespace = name_space; list.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::Aaa::Attribute::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "list") { list.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Client::Configuration::Group::Crypto_::Aaa::Attribute::has_leaf_or_child_of_name(const std::string & name) const { if(name == "list") return true; return false; } Native::Crypto::Isakmp::Client::Configuration::Group::Dhcp::Dhcp() : giaddr{YType::str, "giaddr"}, server{YType::str, "server"}, timeout{YType::uint8, "timeout"} { yang_name = "dhcp"; yang_parent_name = "group"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Client::Configuration::Group::Dhcp::~Dhcp() { } bool Native::Crypto::Isakmp::Client::Configuration::Group::Dhcp::has_data() const { if (is_presence_container) return true; return giaddr.is_set || server.is_set || timeout.is_set; } bool Native::Crypto::Isakmp::Client::Configuration::Group::Dhcp::has_operation() const { return is_set(yfilter) || ydk::is_set(giaddr.yfilter) || ydk::is_set(server.yfilter) || ydk::is_set(timeout.yfilter); } std::string Native::Crypto::Isakmp::Client::Configuration::Group::Dhcp::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "dhcp"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Client::Configuration::Group::Dhcp::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (giaddr.is_set || is_set(giaddr.yfilter)) leaf_name_data.push_back(giaddr.get_name_leafdata()); if (server.is_set || is_set(server.yfilter)) leaf_name_data.push_back(server.get_name_leafdata()); if (timeout.is_set || is_set(timeout.yfilter)) leaf_name_data.push_back(timeout.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Client::Configuration::Group::Dhcp::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Client::Configuration::Group::Dhcp::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Client::Configuration::Group::Dhcp::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "giaddr") { giaddr = value; giaddr.value_namespace = name_space; giaddr.value_namespace_prefix = name_space_prefix; } if(value_path == "server") { server = value; server.value_namespace = name_space; server.value_namespace_prefix = name_space_prefix; } if(value_path == "timeout") { timeout = value; timeout.value_namespace = name_space; timeout.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Client::Configuration::Group::Dhcp::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "giaddr") { giaddr.yfilter = yfilter; } if(value_path == "server") { server.yfilter = yfilter; } if(value_path == "timeout") { timeout.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Client::Configuration::Group::Dhcp::has_leaf_or_child_of_name(const std::string & name) const { if(name == "giaddr" || name == "server" || name == "timeout") return true; return false; } Native::Crypto::Isakmp::Client::Configuration::Group::Dns::Dns() : primary{YType::str, "primary"}, secondary{YType::str, "secondary"} { yang_name = "dns"; yang_parent_name = "group"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Client::Configuration::Group::Dns::~Dns() { } bool Native::Crypto::Isakmp::Client::Configuration::Group::Dns::has_data() const { if (is_presence_container) return true; return primary.is_set || secondary.is_set; } bool Native::Crypto::Isakmp::Client::Configuration::Group::Dns::has_operation() const { return is_set(yfilter) || ydk::is_set(primary.yfilter) || ydk::is_set(secondary.yfilter); } std::string Native::Crypto::Isakmp::Client::Configuration::Group::Dns::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "dns"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Client::Configuration::Group::Dns::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (primary.is_set || is_set(primary.yfilter)) leaf_name_data.push_back(primary.get_name_leafdata()); if (secondary.is_set || is_set(secondary.yfilter)) leaf_name_data.push_back(secondary.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Client::Configuration::Group::Dns::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Client::Configuration::Group::Dns::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Client::Configuration::Group::Dns::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "primary") { primary = value; primary.value_namespace = name_space; primary.value_namespace_prefix = name_space_prefix; } if(value_path == "secondary") { secondary = value; secondary.value_namespace = name_space; secondary.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Client::Configuration::Group::Dns::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "primary") { primary.yfilter = yfilter; } if(value_path == "secondary") { secondary.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Client::Configuration::Group::Dns::has_leaf_or_child_of_name(const std::string & name) const { if(name == "primary" || name == "secondary") return true; return false; } Native::Crypto::Isakmp::Client::Configuration::Group::Firewall::Firewall() : are_u_there{YType::empty, "are-u-there"}, policy{YType::str, "policy"} { yang_name = "firewall"; yang_parent_name = "group"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Client::Configuration::Group::Firewall::~Firewall() { } bool Native::Crypto::Isakmp::Client::Configuration::Group::Firewall::has_data() const { if (is_presence_container) return true; return are_u_there.is_set || policy.is_set; } bool Native::Crypto::Isakmp::Client::Configuration::Group::Firewall::has_operation() const { return is_set(yfilter) || ydk::is_set(are_u_there.yfilter) || ydk::is_set(policy.yfilter); } std::string Native::Crypto::Isakmp::Client::Configuration::Group::Firewall::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "firewall"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Client::Configuration::Group::Firewall::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (are_u_there.is_set || is_set(are_u_there.yfilter)) leaf_name_data.push_back(are_u_there.get_name_leafdata()); if (policy.is_set || is_set(policy.yfilter)) leaf_name_data.push_back(policy.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Client::Configuration::Group::Firewall::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Client::Configuration::Group::Firewall::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Client::Configuration::Group::Firewall::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "are-u-there") { are_u_there = value; are_u_there.value_namespace = name_space; are_u_there.value_namespace_prefix = name_space_prefix; } if(value_path == "policy") { policy = value; policy.value_namespace = name_space; policy.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Client::Configuration::Group::Firewall::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "are-u-there") { are_u_there.yfilter = yfilter; } if(value_path == "policy") { policy.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Client::Configuration::Group::Firewall::has_leaf_or_child_of_name(const std::string & name) const { if(name == "are-u-there" || name == "policy") return true; return false; } Native::Crypto::Isakmp::Client::Configuration::Group::Key::Key() : encryption{YType::enumeration, "encryption"}, key{YType::str, "key"} { yang_name = "key"; yang_parent_name = "group"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Client::Configuration::Group::Key::~Key() { } bool Native::Crypto::Isakmp::Client::Configuration::Group::Key::has_data() const { if (is_presence_container) return true; return encryption.is_set || key.is_set; } bool Native::Crypto::Isakmp::Client::Configuration::Group::Key::has_operation() const { return is_set(yfilter) || ydk::is_set(encryption.yfilter) || ydk::is_set(key.yfilter); } std::string Native::Crypto::Isakmp::Client::Configuration::Group::Key::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "key"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Client::Configuration::Group::Key::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (encryption.is_set || is_set(encryption.yfilter)) leaf_name_data.push_back(encryption.get_name_leafdata()); if (key.is_set || is_set(key.yfilter)) leaf_name_data.push_back(key.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Client::Configuration::Group::Key::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Client::Configuration::Group::Key::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Client::Configuration::Group::Key::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "encryption") { encryption = value; encryption.value_namespace = name_space; encryption.value_namespace_prefix = name_space_prefix; } if(value_path == "key") { key = value; key.value_namespace = name_space; key.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Client::Configuration::Group::Key::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "encryption") { encryption.yfilter = yfilter; } if(value_path == "key") { key.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Client::Configuration::Group::Key::has_leaf_or_child_of_name(const std::string & name) const { if(name == "encryption" || name == "key") return true; return false; } Native::Crypto::Isakmp::Client::Configuration::Group::Wins::Wins() : primary{YType::str, "primary"}, secondary{YType::str, "secondary"} { yang_name = "wins"; yang_parent_name = "group"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Client::Configuration::Group::Wins::~Wins() { } bool Native::Crypto::Isakmp::Client::Configuration::Group::Wins::has_data() const { if (is_presence_container) return true; return primary.is_set || secondary.is_set; } bool Native::Crypto::Isakmp::Client::Configuration::Group::Wins::has_operation() const { return is_set(yfilter) || ydk::is_set(primary.yfilter) || ydk::is_set(secondary.yfilter); } std::string Native::Crypto::Isakmp::Client::Configuration::Group::Wins::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "wins"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Client::Configuration::Group::Wins::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (primary.is_set || is_set(primary.yfilter)) leaf_name_data.push_back(primary.get_name_leafdata()); if (secondary.is_set || is_set(secondary.yfilter)) leaf_name_data.push_back(secondary.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Client::Configuration::Group::Wins::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Client::Configuration::Group::Wins::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Client::Configuration::Group::Wins::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "primary") { primary = value; primary.value_namespace = name_space; primary.value_namespace_prefix = name_space_prefix; } if(value_path == "secondary") { secondary = value; secondary.value_namespace = name_space; secondary.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Client::Configuration::Group::Wins::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "primary") { primary.yfilter = yfilter; } if(value_path == "secondary") { secondary.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Client::Configuration::Group::Wins::has_leaf_or_child_of_name(const std::string & name) const { if(name == "primary" || name == "secondary") return true; return false; } Native::Crypto::Isakmp::Client::Firewall::Firewall() : policy_name{YType::str, "policy-name"}, optional{YType::enumeration, "optional"}, required{YType::enumeration, "required"} , policy(std::make_shared<Native::Crypto::Isakmp::Client::Firewall::Policy>()) { policy->parent = this; yang_name = "firewall"; yang_parent_name = "client"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Isakmp::Client::Firewall::~Firewall() { } bool Native::Crypto::Isakmp::Client::Firewall::has_data() const { if (is_presence_container) return true; return policy_name.is_set || optional.is_set || required.is_set || (policy != nullptr && policy->has_data()); } bool Native::Crypto::Isakmp::Client::Firewall::has_operation() const { return is_set(yfilter) || ydk::is_set(policy_name.yfilter) || ydk::is_set(optional.yfilter) || ydk::is_set(required.yfilter) || (policy != nullptr && policy->has_operation()); } std::string Native::Crypto::Isakmp::Client::Firewall::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:isakmp/client/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Isakmp::Client::Firewall::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "firewall"; ADD_KEY_TOKEN(policy_name, "policy-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Client::Firewall::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (policy_name.is_set || is_set(policy_name.yfilter)) leaf_name_data.push_back(policy_name.get_name_leafdata()); if (optional.is_set || is_set(optional.yfilter)) leaf_name_data.push_back(optional.get_name_leafdata()); if (required.is_set || is_set(required.yfilter)) leaf_name_data.push_back(required.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Client::Firewall::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "policy") { if(policy == nullptr) { policy = std::make_shared<Native::Crypto::Isakmp::Client::Firewall::Policy>(); } return policy; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Client::Firewall::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(policy != nullptr) { _children["policy"] = policy; } return _children; } void Native::Crypto::Isakmp::Client::Firewall::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "policy-name") { policy_name = value; policy_name.value_namespace = name_space; policy_name.value_namespace_prefix = name_space_prefix; } if(value_path == "optional") { optional = value; optional.value_namespace = name_space; optional.value_namespace_prefix = name_space_prefix; } if(value_path == "required") { required = value; required.value_namespace = name_space; required.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Client::Firewall::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "policy-name") { policy_name.yfilter = yfilter; } if(value_path == "optional") { optional.yfilter = yfilter; } if(value_path == "required") { required.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Client::Firewall::has_leaf_or_child_of_name(const std::string & name) const { if(name == "policy" || name == "policy-name" || name == "optional" || name == "required") return true; return false; } Native::Crypto::Isakmp::Client::Firewall::Policy::Policy() : check_presence{YType::empty, "check-presence"} , central_policy_push(std::make_shared<Native::Crypto::Isakmp::Client::Firewall::Policy::CentralPolicyPush>()) { central_policy_push->parent = this; yang_name = "policy"; yang_parent_name = "firewall"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Client::Firewall::Policy::~Policy() { } bool Native::Crypto::Isakmp::Client::Firewall::Policy::has_data() const { if (is_presence_container) return true; return check_presence.is_set || (central_policy_push != nullptr && central_policy_push->has_data()); } bool Native::Crypto::Isakmp::Client::Firewall::Policy::has_operation() const { return is_set(yfilter) || ydk::is_set(check_presence.yfilter) || (central_policy_push != nullptr && central_policy_push->has_operation()); } std::string Native::Crypto::Isakmp::Client::Firewall::Policy::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "policy"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Client::Firewall::Policy::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (check_presence.is_set || is_set(check_presence.yfilter)) leaf_name_data.push_back(check_presence.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Client::Firewall::Policy::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "central-policy-push") { if(central_policy_push == nullptr) { central_policy_push = std::make_shared<Native::Crypto::Isakmp::Client::Firewall::Policy::CentralPolicyPush>(); } return central_policy_push; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Client::Firewall::Policy::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(central_policy_push != nullptr) { _children["central-policy-push"] = central_policy_push; } return _children; } void Native::Crypto::Isakmp::Client::Firewall::Policy::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "check-presence") { check_presence = value; check_presence.value_namespace = name_space; check_presence.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Client::Firewall::Policy::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "check-presence") { check_presence.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Client::Firewall::Policy::has_leaf_or_child_of_name(const std::string & name) const { if(name == "central-policy-push" || name == "check-presence") return true; return false; } Native::Crypto::Isakmp::Client::Firewall::Policy::CentralPolicyPush::CentralPolicyPush() : access_list(std::make_shared<Native::Crypto::Isakmp::Client::Firewall::Policy::CentralPolicyPush::AccessList>()) { access_list->parent = this; yang_name = "central-policy-push"; yang_parent_name = "policy"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Client::Firewall::Policy::CentralPolicyPush::~CentralPolicyPush() { } bool Native::Crypto::Isakmp::Client::Firewall::Policy::CentralPolicyPush::has_data() const { if (is_presence_container) return true; return (access_list != nullptr && access_list->has_data()); } bool Native::Crypto::Isakmp::Client::Firewall::Policy::CentralPolicyPush::has_operation() const { return is_set(yfilter) || (access_list != nullptr && access_list->has_operation()); } std::string Native::Crypto::Isakmp::Client::Firewall::Policy::CentralPolicyPush::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "central-policy-push"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Client::Firewall::Policy::CentralPolicyPush::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Client::Firewall::Policy::CentralPolicyPush::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "access-list") { if(access_list == nullptr) { access_list = std::make_shared<Native::Crypto::Isakmp::Client::Firewall::Policy::CentralPolicyPush::AccessList>(); } return access_list; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Client::Firewall::Policy::CentralPolicyPush::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(access_list != nullptr) { _children["access-list"] = access_list; } return _children; } void Native::Crypto::Isakmp::Client::Firewall::Policy::CentralPolicyPush::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Isakmp::Client::Firewall::Policy::CentralPolicyPush::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Isakmp::Client::Firewall::Policy::CentralPolicyPush::has_leaf_or_child_of_name(const std::string & name) const { if(name == "access-list") return true; return false; } Native::Crypto::Isakmp::Client::Firewall::Policy::CentralPolicyPush::AccessList::AccessList() : direction{YType::enumeration, "direction"}, acl{YType::str, "acl"} { yang_name = "access-list"; yang_parent_name = "central-policy-push"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Client::Firewall::Policy::CentralPolicyPush::AccessList::~AccessList() { } bool Native::Crypto::Isakmp::Client::Firewall::Policy::CentralPolicyPush::AccessList::has_data() const { if (is_presence_container) return true; return direction.is_set || acl.is_set; } bool Native::Crypto::Isakmp::Client::Firewall::Policy::CentralPolicyPush::AccessList::has_operation() const { return is_set(yfilter) || ydk::is_set(direction.yfilter) || ydk::is_set(acl.yfilter); } std::string Native::Crypto::Isakmp::Client::Firewall::Policy::CentralPolicyPush::AccessList::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "access-list"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Client::Firewall::Policy::CentralPolicyPush::AccessList::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (direction.is_set || is_set(direction.yfilter)) leaf_name_data.push_back(direction.get_name_leafdata()); if (acl.is_set || is_set(acl.yfilter)) leaf_name_data.push_back(acl.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Client::Firewall::Policy::CentralPolicyPush::AccessList::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Client::Firewall::Policy::CentralPolicyPush::AccessList::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Client::Firewall::Policy::CentralPolicyPush::AccessList::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "direction") { direction = value; direction.value_namespace = name_space; direction.value_namespace_prefix = name_space_prefix; } if(value_path == "acl") { acl = value; acl.value_namespace = name_space; acl.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Client::Firewall::Policy::CentralPolicyPush::AccessList::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "direction") { direction.yfilter = yfilter; } if(value_path == "acl") { acl.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Client::Firewall::Policy::CentralPolicyPush::AccessList::has_leaf_or_child_of_name(const std::string & name) const { if(name == "direction" || name == "acl") return true; return false; } Native::Crypto::Isakmp::Default::Default() : policy{YType::empty, "policy"} { yang_name = "default"; yang_parent_name = "isakmp"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Isakmp::Default::~Default() { } bool Native::Crypto::Isakmp::Default::has_data() const { if (is_presence_container) return true; return policy.is_set; } bool Native::Crypto::Isakmp::Default::has_operation() const { return is_set(yfilter) || ydk::is_set(policy.yfilter); } std::string Native::Crypto::Isakmp::Default::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:isakmp/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Isakmp::Default::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "default"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Default::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (policy.is_set || is_set(policy.yfilter)) leaf_name_data.push_back(policy.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Default::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Default::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Default::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "policy") { policy = value; policy.value_namespace = name_space; policy.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Default::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "policy") { policy.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Default::has_leaf_or_child_of_name(const std::string & name) const { if(name == "policy") return true; return false; } Native::Crypto::Isakmp::Keepalive::Keepalive() : number{YType::uint16, "number"}, retry_number{YType::uint8, "retry-number"}, send{YType::enumeration, "send"} { yang_name = "keepalive"; yang_parent_name = "isakmp"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Isakmp::Keepalive::~Keepalive() { } bool Native::Crypto::Isakmp::Keepalive::has_data() const { if (is_presence_container) return true; return number.is_set || retry_number.is_set || send.is_set; } bool Native::Crypto::Isakmp::Keepalive::has_operation() const { return is_set(yfilter) || ydk::is_set(number.yfilter) || ydk::is_set(retry_number.yfilter) || ydk::is_set(send.yfilter); } std::string Native::Crypto::Isakmp::Keepalive::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:isakmp/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Isakmp::Keepalive::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "keepalive"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Keepalive::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (number.is_set || is_set(number.yfilter)) leaf_name_data.push_back(number.get_name_leafdata()); if (retry_number.is_set || is_set(retry_number.yfilter)) leaf_name_data.push_back(retry_number.get_name_leafdata()); if (send.is_set || is_set(send.yfilter)) leaf_name_data.push_back(send.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Keepalive::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Keepalive::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Keepalive::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "number") { number = value; number.value_namespace = name_space; number.value_namespace_prefix = name_space_prefix; } if(value_path == "retry-number") { retry_number = value; retry_number.value_namespace = name_space; retry_number.value_namespace_prefix = name_space_prefix; } if(value_path == "send") { send = value; send.value_namespace = name_space; send.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Keepalive::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "number") { number.yfilter = yfilter; } if(value_path == "retry-number") { retry_number.yfilter = yfilter; } if(value_path == "send") { send.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Keepalive::has_leaf_or_child_of_name(const std::string & name) const { if(name == "number" || name == "retry-number" || name == "send") return true; return false; } Native::Crypto::Isakmp::Key::Key() : key_address(std::make_shared<Native::Crypto::Isakmp::Key::KeyAddress>()) , key_host(std::make_shared<Native::Crypto::Isakmp::Key::KeyHost>()) { key_address->parent = this; key_host->parent = this; yang_name = "key"; yang_parent_name = "isakmp"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Isakmp::Key::~Key() { } bool Native::Crypto::Isakmp::Key::has_data() const { if (is_presence_container) return true; return (key_address != nullptr && key_address->has_data()) || (key_host != nullptr && key_host->has_data()); } bool Native::Crypto::Isakmp::Key::has_operation() const { return is_set(yfilter) || (key_address != nullptr && key_address->has_operation()) || (key_host != nullptr && key_host->has_operation()); } std::string Native::Crypto::Isakmp::Key::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:isakmp/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Isakmp::Key::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "key"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Key::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Key::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "key-address") { if(key_address == nullptr) { key_address = std::make_shared<Native::Crypto::Isakmp::Key::KeyAddress>(); } return key_address; } if(child_yang_name == "key-host") { if(key_host == nullptr) { key_host = std::make_shared<Native::Crypto::Isakmp::Key::KeyHost>(); } return key_host; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Key::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(key_address != nullptr) { _children["key-address"] = key_address; } if(key_host != nullptr) { _children["key-host"] = key_host; } return _children; } void Native::Crypto::Isakmp::Key::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Isakmp::Key::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Isakmp::Key::has_leaf_or_child_of_name(const std::string & name) const { if(name == "key-address" || name == "key-host") return true; return false; } Native::Crypto::Isakmp::Key::KeyAddress::KeyAddress() : encryption{YType::enumeration, "encryption"}, key{YType::str, "key"} , addr4_container(std::make_shared<Native::Crypto::Isakmp::Key::KeyAddress::Addr4Container>()) , addr6_container(std::make_shared<Native::Crypto::Isakmp::Key::KeyAddress::Addr6Container>()) { addr4_container->parent = this; addr6_container->parent = this; yang_name = "key-address"; yang_parent_name = "key"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Isakmp::Key::KeyAddress::~KeyAddress() { } bool Native::Crypto::Isakmp::Key::KeyAddress::has_data() const { if (is_presence_container) return true; return encryption.is_set || key.is_set || (addr4_container != nullptr && addr4_container->has_data()) || (addr6_container != nullptr && addr6_container->has_data()); } bool Native::Crypto::Isakmp::Key::KeyAddress::has_operation() const { return is_set(yfilter) || ydk::is_set(encryption.yfilter) || ydk::is_set(key.yfilter) || (addr4_container != nullptr && addr4_container->has_operation()) || (addr6_container != nullptr && addr6_container->has_operation()); } std::string Native::Crypto::Isakmp::Key::KeyAddress::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:isakmp/key/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Isakmp::Key::KeyAddress::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "key-address"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Key::KeyAddress::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (encryption.is_set || is_set(encryption.yfilter)) leaf_name_data.push_back(encryption.get_name_leafdata()); if (key.is_set || is_set(key.yfilter)) leaf_name_data.push_back(key.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Key::KeyAddress::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "addr4-container") { if(addr4_container == nullptr) { addr4_container = std::make_shared<Native::Crypto::Isakmp::Key::KeyAddress::Addr4Container>(); } return addr4_container; } if(child_yang_name == "addr6-container") { if(addr6_container == nullptr) { addr6_container = std::make_shared<Native::Crypto::Isakmp::Key::KeyAddress::Addr6Container>(); } return addr6_container; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Key::KeyAddress::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(addr4_container != nullptr) { _children["addr4-container"] = addr4_container; } if(addr6_container != nullptr) { _children["addr6-container"] = addr6_container; } return _children; } void Native::Crypto::Isakmp::Key::KeyAddress::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "encryption") { encryption = value; encryption.value_namespace = name_space; encryption.value_namespace_prefix = name_space_prefix; } if(value_path == "key") { key = value; key.value_namespace = name_space; key.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Key::KeyAddress::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "encryption") { encryption.yfilter = yfilter; } if(value_path == "key") { key.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Key::KeyAddress::has_leaf_or_child_of_name(const std::string & name) const { if(name == "addr4-container" || name == "addr6-container" || name == "encryption" || name == "key") return true; return false; } Native::Crypto::Isakmp::Key::KeyAddress::Addr4Container::Addr4Container() : address{YType::str, "address"}, mask{YType::str, "mask"}, no_xauth{YType::empty, "no-xauth"} { yang_name = "addr4-container"; yang_parent_name = "key-address"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Isakmp::Key::KeyAddress::Addr4Container::~Addr4Container() { } bool Native::Crypto::Isakmp::Key::KeyAddress::Addr4Container::has_data() const { if (is_presence_container) return true; return address.is_set || mask.is_set || no_xauth.is_set; } bool Native::Crypto::Isakmp::Key::KeyAddress::Addr4Container::has_operation() const { return is_set(yfilter) || ydk::is_set(address.yfilter) || ydk::is_set(mask.yfilter) || ydk::is_set(no_xauth.yfilter); } std::string Native::Crypto::Isakmp::Key::KeyAddress::Addr4Container::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:isakmp/key/key-address/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Isakmp::Key::KeyAddress::Addr4Container::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "addr4-container"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Key::KeyAddress::Addr4Container::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (address.is_set || is_set(address.yfilter)) leaf_name_data.push_back(address.get_name_leafdata()); if (mask.is_set || is_set(mask.yfilter)) leaf_name_data.push_back(mask.get_name_leafdata()); if (no_xauth.is_set || is_set(no_xauth.yfilter)) leaf_name_data.push_back(no_xauth.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Key::KeyAddress::Addr4Container::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Key::KeyAddress::Addr4Container::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Key::KeyAddress::Addr4Container::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "address") { address = value; address.value_namespace = name_space; address.value_namespace_prefix = name_space_prefix; } if(value_path == "mask") { mask = value; mask.value_namespace = name_space; mask.value_namespace_prefix = name_space_prefix; } if(value_path == "no-xauth") { no_xauth = value; no_xauth.value_namespace = name_space; no_xauth.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Key::KeyAddress::Addr4Container::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "address") { address.yfilter = yfilter; } if(value_path == "mask") { mask.yfilter = yfilter; } if(value_path == "no-xauth") { no_xauth.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Key::KeyAddress::Addr4Container::has_leaf_or_child_of_name(const std::string & name) const { if(name == "address" || name == "mask" || name == "no-xauth") return true; return false; } Native::Crypto::Isakmp::Key::KeyAddress::Addr6Container::Addr6Container() : address(std::make_shared<Native::Crypto::Isakmp::Key::KeyAddress::Addr6Container::Address>()) { address->parent = this; yang_name = "addr6-container"; yang_parent_name = "key-address"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Isakmp::Key::KeyAddress::Addr6Container::~Addr6Container() { } bool Native::Crypto::Isakmp::Key::KeyAddress::Addr6Container::has_data() const { if (is_presence_container) return true; return (address != nullptr && address->has_data()); } bool Native::Crypto::Isakmp::Key::KeyAddress::Addr6Container::has_operation() const { return is_set(yfilter) || (address != nullptr && address->has_operation()); } std::string Native::Crypto::Isakmp::Key::KeyAddress::Addr6Container::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:isakmp/key/key-address/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Isakmp::Key::KeyAddress::Addr6Container::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "addr6-container"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Key::KeyAddress::Addr6Container::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Key::KeyAddress::Addr6Container::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "address") { if(address == nullptr) { address = std::make_shared<Native::Crypto::Isakmp::Key::KeyAddress::Addr6Container::Address>(); } return address; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Key::KeyAddress::Addr6Container::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(address != nullptr) { _children["address"] = address; } return _children; } void Native::Crypto::Isakmp::Key::KeyAddress::Addr6Container::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Isakmp::Key::KeyAddress::Addr6Container::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Isakmp::Key::KeyAddress::Addr6Container::has_leaf_or_child_of_name(const std::string & name) const { if(name == "address") return true; return false; } Native::Crypto::Isakmp::Key::KeyAddress::Addr6Container::Address::Address() : ipv6{YType::str, "ipv6"}, no_xauth{YType::empty, "no-xauth"} { yang_name = "address"; yang_parent_name = "addr6-container"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Isakmp::Key::KeyAddress::Addr6Container::Address::~Address() { } bool Native::Crypto::Isakmp::Key::KeyAddress::Addr6Container::Address::has_data() const { if (is_presence_container) return true; return ipv6.is_set || no_xauth.is_set; } bool Native::Crypto::Isakmp::Key::KeyAddress::Addr6Container::Address::has_operation() const { return is_set(yfilter) || ydk::is_set(ipv6.yfilter) || ydk::is_set(no_xauth.yfilter); } std::string Native::Crypto::Isakmp::Key::KeyAddress::Addr6Container::Address::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:isakmp/key/key-address/addr6-container/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Isakmp::Key::KeyAddress::Addr6Container::Address::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "address"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Key::KeyAddress::Addr6Container::Address::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (ipv6.is_set || is_set(ipv6.yfilter)) leaf_name_data.push_back(ipv6.get_name_leafdata()); if (no_xauth.is_set || is_set(no_xauth.yfilter)) leaf_name_data.push_back(no_xauth.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Key::KeyAddress::Addr6Container::Address::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Key::KeyAddress::Addr6Container::Address::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Key::KeyAddress::Addr6Container::Address::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "ipv6") { ipv6 = value; ipv6.value_namespace = name_space; ipv6.value_namespace_prefix = name_space_prefix; } if(value_path == "no-xauth") { no_xauth = value; no_xauth.value_namespace = name_space; no_xauth.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Key::KeyAddress::Addr6Container::Address::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ipv6") { ipv6.yfilter = yfilter; } if(value_path == "no-xauth") { no_xauth.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Key::KeyAddress::Addr6Container::Address::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipv6" || name == "no-xauth") return true; return false; } Native::Crypto::Isakmp::Key::KeyHost::KeyHost() : encryption{YType::enumeration, "encryption"}, key{YType::str, "key"} , host_container(std::make_shared<Native::Crypto::Isakmp::Key::KeyHost::HostContainer>()) { host_container->parent = this; yang_name = "key-host"; yang_parent_name = "key"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Isakmp::Key::KeyHost::~KeyHost() { } bool Native::Crypto::Isakmp::Key::KeyHost::has_data() const { if (is_presence_container) return true; return encryption.is_set || key.is_set || (host_container != nullptr && host_container->has_data()); } bool Native::Crypto::Isakmp::Key::KeyHost::has_operation() const { return is_set(yfilter) || ydk::is_set(encryption.yfilter) || ydk::is_set(key.yfilter) || (host_container != nullptr && host_container->has_operation()); } std::string Native::Crypto::Isakmp::Key::KeyHost::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:isakmp/key/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Isakmp::Key::KeyHost::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "key-host"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Key::KeyHost::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (encryption.is_set || is_set(encryption.yfilter)) leaf_name_data.push_back(encryption.get_name_leafdata()); if (key.is_set || is_set(key.yfilter)) leaf_name_data.push_back(key.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Key::KeyHost::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "host-container") { if(host_container == nullptr) { host_container = std::make_shared<Native::Crypto::Isakmp::Key::KeyHost::HostContainer>(); } return host_container; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Key::KeyHost::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(host_container != nullptr) { _children["host-container"] = host_container; } return _children; } void Native::Crypto::Isakmp::Key::KeyHost::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "encryption") { encryption = value; encryption.value_namespace = name_space; encryption.value_namespace_prefix = name_space_prefix; } if(value_path == "key") { key = value; key.value_namespace = name_space; key.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Key::KeyHost::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "encryption") { encryption.yfilter = yfilter; } if(value_path == "key") { key.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Key::KeyHost::has_leaf_or_child_of_name(const std::string & name) const { if(name == "host-container" || name == "encryption" || name == "key") return true; return false; } Native::Crypto::Isakmp::Key::KeyHost::HostContainer::HostContainer() : hostname{YType::str, "hostname"}, no_xauth{YType::empty, "no-xauth"} { yang_name = "host-container"; yang_parent_name = "key-host"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Isakmp::Key::KeyHost::HostContainer::~HostContainer() { } bool Native::Crypto::Isakmp::Key::KeyHost::HostContainer::has_data() const { if (is_presence_container) return true; return hostname.is_set || no_xauth.is_set; } bool Native::Crypto::Isakmp::Key::KeyHost::HostContainer::has_operation() const { return is_set(yfilter) || ydk::is_set(hostname.yfilter) || ydk::is_set(no_xauth.yfilter); } std::string Native::Crypto::Isakmp::Key::KeyHost::HostContainer::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:isakmp/key/key-host/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Isakmp::Key::KeyHost::HostContainer::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "host-container"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Key::KeyHost::HostContainer::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (hostname.is_set || is_set(hostname.yfilter)) leaf_name_data.push_back(hostname.get_name_leafdata()); if (no_xauth.is_set || is_set(no_xauth.yfilter)) leaf_name_data.push_back(no_xauth.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Key::KeyHost::HostContainer::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Key::KeyHost::HostContainer::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Key::KeyHost::HostContainer::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "hostname") { hostname = value; hostname.value_namespace = name_space; hostname.value_namespace_prefix = name_space_prefix; } if(value_path == "no-xauth") { no_xauth = value; no_xauth.value_namespace = name_space; no_xauth.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Key::KeyHost::HostContainer::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "hostname") { hostname.yfilter = yfilter; } if(value_path == "no-xauth") { no_xauth.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Key::KeyHost::HostContainer::has_leaf_or_child_of_name(const std::string & name) const { if(name == "hostname" || name == "no-xauth") return true; return false; } Native::Crypto::Isakmp::Nat::Nat() : keepalive{YType::uint16, "keepalive"} { yang_name = "nat"; yang_parent_name = "isakmp"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Isakmp::Nat::~Nat() { } bool Native::Crypto::Isakmp::Nat::has_data() const { if (is_presence_container) return true; return keepalive.is_set; } bool Native::Crypto::Isakmp::Nat::has_operation() const { return is_set(yfilter) || ydk::is_set(keepalive.yfilter); } std::string Native::Crypto::Isakmp::Nat::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:isakmp/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Isakmp::Nat::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "nat"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Nat::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (keepalive.is_set || is_set(keepalive.yfilter)) leaf_name_data.push_back(keepalive.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Nat::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Nat::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Nat::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "keepalive") { keepalive = value; keepalive.value_namespace = name_space; keepalive.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Nat::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "keepalive") { keepalive.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Nat::has_leaf_or_child_of_name(const std::string & name) const { if(name == "keepalive") return true; return false; } Native::Crypto::Isakmp::Peer::Peer() : ipv4_addr(std::make_shared<Native::Crypto::Isakmp::Peer::Ipv4Addr>()) , ipv6_addr(std::make_shared<Native::Crypto::Isakmp::Peer::Ipv6Addr>()) , hostname(this, {"name"}) { ipv4_addr->parent = this; ipv6_addr->parent = this; yang_name = "peer"; yang_parent_name = "isakmp"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Isakmp::Peer::~Peer() { } bool Native::Crypto::Isakmp::Peer::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<hostname.len(); index++) { if(hostname[index]->has_data()) return true; } return (ipv4_addr != nullptr && ipv4_addr->has_data()) || (ipv6_addr != nullptr && ipv6_addr->has_data()); } bool Native::Crypto::Isakmp::Peer::has_operation() const { for (std::size_t index=0; index<hostname.len(); index++) { if(hostname[index]->has_operation()) return true; } return is_set(yfilter) || (ipv4_addr != nullptr && ipv4_addr->has_operation()) || (ipv6_addr != nullptr && ipv6_addr->has_operation()); } std::string Native::Crypto::Isakmp::Peer::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:isakmp/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Isakmp::Peer::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "peer"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Peer::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Peer::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "ipv4-addr") { if(ipv4_addr == nullptr) { ipv4_addr = std::make_shared<Native::Crypto::Isakmp::Peer::Ipv4Addr>(); } return ipv4_addr; } if(child_yang_name == "ipv6-addr") { if(ipv6_addr == nullptr) { ipv6_addr = std::make_shared<Native::Crypto::Isakmp::Peer::Ipv6Addr>(); } return ipv6_addr; } if(child_yang_name == "hostname") { auto ent_ = std::make_shared<Native::Crypto::Isakmp::Peer::Hostname>(); ent_->parent = this; hostname.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Peer::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(ipv4_addr != nullptr) { _children["ipv4-addr"] = ipv4_addr; } if(ipv6_addr != nullptr) { _children["ipv6-addr"] = ipv6_addr; } count_ = 0; for (auto ent_ : hostname.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void Native::Crypto::Isakmp::Peer::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Isakmp::Peer::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Isakmp::Peer::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipv4-addr" || name == "ipv6-addr" || name == "hostname") return true; return false; } Native::Crypto::Isakmp::Peer::Ipv4Addr::Ipv4Addr() : address(this, {"ipv4"}) { yang_name = "ipv4-addr"; yang_parent_name = "peer"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Isakmp::Peer::Ipv4Addr::~Ipv4Addr() { } bool Native::Crypto::Isakmp::Peer::Ipv4Addr::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<address.len(); index++) { if(address[index]->has_data()) return true; } return false; } bool Native::Crypto::Isakmp::Peer::Ipv4Addr::has_operation() const { for (std::size_t index=0; index<address.len(); index++) { if(address[index]->has_operation()) return true; } return is_set(yfilter); } std::string Native::Crypto::Isakmp::Peer::Ipv4Addr::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:isakmp/peer/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Isakmp::Peer::Ipv4Addr::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipv4-addr"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Peer::Ipv4Addr::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Peer::Ipv4Addr::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "address") { auto ent_ = std::make_shared<Native::Crypto::Isakmp::Peer::Ipv4Addr::Address>(); ent_->parent = this; address.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Peer::Ipv4Addr::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : address.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void Native::Crypto::Isakmp::Peer::Ipv4Addr::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Isakmp::Peer::Ipv4Addr::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Isakmp::Peer::Ipv4Addr::has_leaf_or_child_of_name(const std::string & name) const { if(name == "address") return true; return false; } Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Address() : ipv4{YType::str, "ipv4"}, vrf{YType::str, "vrf"}, description{YType::str, "description"} , set(std::make_shared<Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set>()) { set->parent = this; yang_name = "address"; yang_parent_name = "ipv4-addr"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::~Address() { } bool Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::has_data() const { if (is_presence_container) return true; return ipv4.is_set || vrf.is_set || description.is_set || (set != nullptr && set->has_data()); } bool Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::has_operation() const { return is_set(yfilter) || ydk::is_set(ipv4.yfilter) || ydk::is_set(vrf.yfilter) || ydk::is_set(description.yfilter) || (set != nullptr && set->has_operation()); } std::string Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:isakmp/peer/ipv4-addr/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "address"; ADD_KEY_TOKEN(ipv4, "ipv4"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (ipv4.is_set || is_set(ipv4.yfilter)) leaf_name_data.push_back(ipv4.get_name_leafdata()); if (vrf.is_set || is_set(vrf.yfilter)) leaf_name_data.push_back(vrf.get_name_leafdata()); if (description.is_set || is_set(description.yfilter)) leaf_name_data.push_back(description.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "set") { if(set == nullptr) { set = std::make_shared<Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set>(); } return set; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(set != nullptr) { _children["set"] = set; } return _children; } void Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "ipv4") { ipv4 = value; ipv4.value_namespace = name_space; ipv4.value_namespace_prefix = name_space_prefix; } if(value_path == "vrf") { vrf = value; vrf.value_namespace = name_space; vrf.value_namespace_prefix = name_space_prefix; } if(value_path == "description") { description = value; description.value_namespace = name_space; description.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ipv4") { ipv4.yfilter = yfilter; } if(value_path == "vrf") { vrf.yfilter = yfilter; } if(value_path == "description") { description.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::has_leaf_or_child_of_name(const std::string & name) const { if(name == "set" || name == "ipv4" || name == "vrf" || name == "description") return true; return false; } Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::Set() : aggressive_mode(std::make_shared<Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode>()) { aggressive_mode->parent = this; yang_name = "set"; yang_parent_name = "address"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::~Set() { } bool Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::has_data() const { if (is_presence_container) return true; return (aggressive_mode != nullptr && aggressive_mode->has_data()); } bool Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::has_operation() const { return is_set(yfilter) || (aggressive_mode != nullptr && aggressive_mode->has_operation()); } std::string Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "set"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "aggressive-mode") { if(aggressive_mode == nullptr) { aggressive_mode = std::make_shared<Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode>(); } return aggressive_mode; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(aggressive_mode != nullptr) { _children["aggressive-mode"] = aggressive_mode; } return _children; } void Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::has_leaf_or_child_of_name(const std::string & name) const { if(name == "aggressive-mode") return true; return false; } Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::AggressiveMode() : client_endpoint(std::make_shared<Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::ClientEndpoint>()) , password(std::make_shared<Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::Password>()) { client_endpoint->parent = this; password->parent = this; yang_name = "aggressive-mode"; yang_parent_name = "set"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::~AggressiveMode() { } bool Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::has_data() const { if (is_presence_container) return true; return (client_endpoint != nullptr && client_endpoint->has_data()) || (password != nullptr && password->has_data()); } bool Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::has_operation() const { return is_set(yfilter) || (client_endpoint != nullptr && client_endpoint->has_operation()) || (password != nullptr && password->has_operation()); } std::string Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "aggressive-mode"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "client-endpoint") { if(client_endpoint == nullptr) { client_endpoint = std::make_shared<Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::ClientEndpoint>(); } return client_endpoint; } if(child_yang_name == "password") { if(password == nullptr) { password = std::make_shared<Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::Password>(); } return password; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(client_endpoint != nullptr) { _children["client-endpoint"] = client_endpoint; } if(password != nullptr) { _children["password"] = password; } return _children; } void Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::has_leaf_or_child_of_name(const std::string & name) const { if(name == "client-endpoint" || name == "password") return true; return false; } Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::ClientEndpoint::ClientEndpoint() : fqdn{YType::str, "fqdn"}, ipv4_address{YType::str, "ipv4-address"}, ipv6_address{YType::str, "ipv6-address"}, user_fqdn{YType::str, "user-fqdn"} { yang_name = "client-endpoint"; yang_parent_name = "aggressive-mode"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::ClientEndpoint::~ClientEndpoint() { } bool Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::ClientEndpoint::has_data() const { if (is_presence_container) return true; return fqdn.is_set || ipv4_address.is_set || ipv6_address.is_set || user_fqdn.is_set; } bool Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::ClientEndpoint::has_operation() const { return is_set(yfilter) || ydk::is_set(fqdn.yfilter) || ydk::is_set(ipv4_address.yfilter) || ydk::is_set(ipv6_address.yfilter) || ydk::is_set(user_fqdn.yfilter); } std::string Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::ClientEndpoint::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "client-endpoint"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::ClientEndpoint::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (fqdn.is_set || is_set(fqdn.yfilter)) leaf_name_data.push_back(fqdn.get_name_leafdata()); if (ipv4_address.is_set || is_set(ipv4_address.yfilter)) leaf_name_data.push_back(ipv4_address.get_name_leafdata()); if (ipv6_address.is_set || is_set(ipv6_address.yfilter)) leaf_name_data.push_back(ipv6_address.get_name_leafdata()); if (user_fqdn.is_set || is_set(user_fqdn.yfilter)) leaf_name_data.push_back(user_fqdn.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::ClientEndpoint::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::ClientEndpoint::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::ClientEndpoint::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "fqdn") { fqdn = value; fqdn.value_namespace = name_space; fqdn.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv4-address") { ipv4_address = value; ipv4_address.value_namespace = name_space; ipv4_address.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6-address") { ipv6_address = value; ipv6_address.value_namespace = name_space; ipv6_address.value_namespace_prefix = name_space_prefix; } if(value_path == "user-fqdn") { user_fqdn = value; user_fqdn.value_namespace = name_space; user_fqdn.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::ClientEndpoint::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "fqdn") { fqdn.yfilter = yfilter; } if(value_path == "ipv4-address") { ipv4_address.yfilter = yfilter; } if(value_path == "ipv6-address") { ipv6_address.yfilter = yfilter; } if(value_path == "user-fqdn") { user_fqdn.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::ClientEndpoint::has_leaf_or_child_of_name(const std::string & name) const { if(name == "fqdn" || name == "ipv4-address" || name == "ipv6-address" || name == "user-fqdn") return true; return false; } Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::Password::Password() : encryption{YType::enumeration, "encryption"}, key{YType::str, "key"} { yang_name = "password"; yang_parent_name = "aggressive-mode"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::Password::~Password() { } bool Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::Password::has_data() const { if (is_presence_container) return true; return encryption.is_set || key.is_set; } bool Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::Password::has_operation() const { return is_set(yfilter) || ydk::is_set(encryption.yfilter) || ydk::is_set(key.yfilter); } std::string Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::Password::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "password"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::Password::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (encryption.is_set || is_set(encryption.yfilter)) leaf_name_data.push_back(encryption.get_name_leafdata()); if (key.is_set || is_set(key.yfilter)) leaf_name_data.push_back(key.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::Password::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::Password::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::Password::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "encryption") { encryption = value; encryption.value_namespace = name_space; encryption.value_namespace_prefix = name_space_prefix; } if(value_path == "key") { key = value; key.value_namespace = name_space; key.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::Password::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "encryption") { encryption.yfilter = yfilter; } if(value_path == "key") { key.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::Password::has_leaf_or_child_of_name(const std::string & name) const { if(name == "encryption" || name == "key") return true; return false; } Native::Crypto::Isakmp::Peer::Ipv6Addr::Ipv6Addr() : address(this, {"ipv6"}) { yang_name = "ipv6-addr"; yang_parent_name = "peer"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Isakmp::Peer::Ipv6Addr::~Ipv6Addr() { } bool Native::Crypto::Isakmp::Peer::Ipv6Addr::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<address.len(); index++) { if(address[index]->has_data()) return true; } return false; } bool Native::Crypto::Isakmp::Peer::Ipv6Addr::has_operation() const { for (std::size_t index=0; index<address.len(); index++) { if(address[index]->has_operation()) return true; } return is_set(yfilter); } std::string Native::Crypto::Isakmp::Peer::Ipv6Addr::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:isakmp/peer/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Isakmp::Peer::Ipv6Addr::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipv6-addr"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Peer::Ipv6Addr::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Peer::Ipv6Addr::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "address") { auto ent_ = std::make_shared<Native::Crypto::Isakmp::Peer::Ipv6Addr::Address>(); ent_->parent = this; address.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Peer::Ipv6Addr::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : address.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void Native::Crypto::Isakmp::Peer::Ipv6Addr::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Isakmp::Peer::Ipv6Addr::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Isakmp::Peer::Ipv6Addr::has_leaf_or_child_of_name(const std::string & name) const { if(name == "address") return true; return false; } Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Address() : ipv6{YType::str, "ipv6"}, vrf{YType::str, "vrf"}, description{YType::str, "description"} , set(std::make_shared<Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set>()) { set->parent = this; yang_name = "address"; yang_parent_name = "ipv6-addr"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::~Address() { } bool Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::has_data() const { if (is_presence_container) return true; return ipv6.is_set || vrf.is_set || description.is_set || (set != nullptr && set->has_data()); } bool Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::has_operation() const { return is_set(yfilter) || ydk::is_set(ipv6.yfilter) || ydk::is_set(vrf.yfilter) || ydk::is_set(description.yfilter) || (set != nullptr && set->has_operation()); } std::string Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:isakmp/peer/ipv6-addr/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "address"; ADD_KEY_TOKEN(ipv6, "ipv6"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (ipv6.is_set || is_set(ipv6.yfilter)) leaf_name_data.push_back(ipv6.get_name_leafdata()); if (vrf.is_set || is_set(vrf.yfilter)) leaf_name_data.push_back(vrf.get_name_leafdata()); if (description.is_set || is_set(description.yfilter)) leaf_name_data.push_back(description.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "set") { if(set == nullptr) { set = std::make_shared<Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set>(); } return set; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(set != nullptr) { _children["set"] = set; } return _children; } void Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "ipv6") { ipv6 = value; ipv6.value_namespace = name_space; ipv6.value_namespace_prefix = name_space_prefix; } if(value_path == "vrf") { vrf = value; vrf.value_namespace = name_space; vrf.value_namespace_prefix = name_space_prefix; } if(value_path == "description") { description = value; description.value_namespace = name_space; description.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ipv6") { ipv6.yfilter = yfilter; } if(value_path == "vrf") { vrf.yfilter = yfilter; } if(value_path == "description") { description.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::has_leaf_or_child_of_name(const std::string & name) const { if(name == "set" || name == "ipv6" || name == "vrf" || name == "description") return true; return false; } Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::Set() : aggressive_mode(std::make_shared<Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode>()) { aggressive_mode->parent = this; yang_name = "set"; yang_parent_name = "address"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::~Set() { } bool Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::has_data() const { if (is_presence_container) return true; return (aggressive_mode != nullptr && aggressive_mode->has_data()); } bool Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::has_operation() const { return is_set(yfilter) || (aggressive_mode != nullptr && aggressive_mode->has_operation()); } std::string Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "set"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "aggressive-mode") { if(aggressive_mode == nullptr) { aggressive_mode = std::make_shared<Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode>(); } return aggressive_mode; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(aggressive_mode != nullptr) { _children["aggressive-mode"] = aggressive_mode; } return _children; } void Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::has_leaf_or_child_of_name(const std::string & name) const { if(name == "aggressive-mode") return true; return false; } Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::AggressiveMode() : client_endpoint(std::make_shared<Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::ClientEndpoint>()) , password(std::make_shared<Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::Password>()) { client_endpoint->parent = this; password->parent = this; yang_name = "aggressive-mode"; yang_parent_name = "set"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::~AggressiveMode() { } bool Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::has_data() const { if (is_presence_container) return true; return (client_endpoint != nullptr && client_endpoint->has_data()) || (password != nullptr && password->has_data()); } bool Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::has_operation() const { return is_set(yfilter) || (client_endpoint != nullptr && client_endpoint->has_operation()) || (password != nullptr && password->has_operation()); } std::string Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "aggressive-mode"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "client-endpoint") { if(client_endpoint == nullptr) { client_endpoint = std::make_shared<Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::ClientEndpoint>(); } return client_endpoint; } if(child_yang_name == "password") { if(password == nullptr) { password = std::make_shared<Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::Password>(); } return password; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(client_endpoint != nullptr) { _children["client-endpoint"] = client_endpoint; } if(password != nullptr) { _children["password"] = password; } return _children; } void Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::has_leaf_or_child_of_name(const std::string & name) const { if(name == "client-endpoint" || name == "password") return true; return false; } Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::ClientEndpoint::ClientEndpoint() : fqdn{YType::str, "fqdn"}, ipv4_address{YType::str, "ipv4-address"}, ipv6_address{YType::str, "ipv6-address"}, user_fqdn{YType::str, "user-fqdn"} { yang_name = "client-endpoint"; yang_parent_name = "aggressive-mode"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::ClientEndpoint::~ClientEndpoint() { } bool Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::ClientEndpoint::has_data() const { if (is_presence_container) return true; return fqdn.is_set || ipv4_address.is_set || ipv6_address.is_set || user_fqdn.is_set; } bool Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::ClientEndpoint::has_operation() const { return is_set(yfilter) || ydk::is_set(fqdn.yfilter) || ydk::is_set(ipv4_address.yfilter) || ydk::is_set(ipv6_address.yfilter) || ydk::is_set(user_fqdn.yfilter); } std::string Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::ClientEndpoint::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "client-endpoint"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::ClientEndpoint::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (fqdn.is_set || is_set(fqdn.yfilter)) leaf_name_data.push_back(fqdn.get_name_leafdata()); if (ipv4_address.is_set || is_set(ipv4_address.yfilter)) leaf_name_data.push_back(ipv4_address.get_name_leafdata()); if (ipv6_address.is_set || is_set(ipv6_address.yfilter)) leaf_name_data.push_back(ipv6_address.get_name_leafdata()); if (user_fqdn.is_set || is_set(user_fqdn.yfilter)) leaf_name_data.push_back(user_fqdn.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::ClientEndpoint::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::ClientEndpoint::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::ClientEndpoint::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "fqdn") { fqdn = value; fqdn.value_namespace = name_space; fqdn.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv4-address") { ipv4_address = value; ipv4_address.value_namespace = name_space; ipv4_address.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6-address") { ipv6_address = value; ipv6_address.value_namespace = name_space; ipv6_address.value_namespace_prefix = name_space_prefix; } if(value_path == "user-fqdn") { user_fqdn = value; user_fqdn.value_namespace = name_space; user_fqdn.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::ClientEndpoint::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "fqdn") { fqdn.yfilter = yfilter; } if(value_path == "ipv4-address") { ipv4_address.yfilter = yfilter; } if(value_path == "ipv6-address") { ipv6_address.yfilter = yfilter; } if(value_path == "user-fqdn") { user_fqdn.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::ClientEndpoint::has_leaf_or_child_of_name(const std::string & name) const { if(name == "fqdn" || name == "ipv4-address" || name == "ipv6-address" || name == "user-fqdn") return true; return false; } Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::Password::Password() : encryption{YType::enumeration, "encryption"}, key{YType::str, "key"} { yang_name = "password"; yang_parent_name = "aggressive-mode"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::Password::~Password() { } bool Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::Password::has_data() const { if (is_presence_container) return true; return encryption.is_set || key.is_set; } bool Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::Password::has_operation() const { return is_set(yfilter) || ydk::is_set(encryption.yfilter) || ydk::is_set(key.yfilter); } std::string Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::Password::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "password"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::Password::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (encryption.is_set || is_set(encryption.yfilter)) leaf_name_data.push_back(encryption.get_name_leafdata()); if (key.is_set || is_set(key.yfilter)) leaf_name_data.push_back(key.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::Password::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::Password::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::Password::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "encryption") { encryption = value; encryption.value_namespace = name_space; encryption.value_namespace_prefix = name_space_prefix; } if(value_path == "key") { key = value; key.value_namespace = name_space; key.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::Password::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "encryption") { encryption.yfilter = yfilter; } if(value_path == "key") { key.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::Password::has_leaf_or_child_of_name(const std::string & name) const { if(name == "encryption" || name == "key") return true; return false; } Native::Crypto::Isakmp::Peer::Hostname::Hostname() : name{YType::str, "name"}, vrf{YType::str, "vrf"}, description{YType::str, "description"} , set(std::make_shared<Native::Crypto::Isakmp::Peer::Hostname::Set>()) { set->parent = this; yang_name = "hostname"; yang_parent_name = "peer"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Isakmp::Peer::Hostname::~Hostname() { } bool Native::Crypto::Isakmp::Peer::Hostname::has_data() const { if (is_presence_container) return true; return name.is_set || vrf.is_set || description.is_set || (set != nullptr && set->has_data()); } bool Native::Crypto::Isakmp::Peer::Hostname::has_operation() const { return is_set(yfilter) || ydk::is_set(name.yfilter) || ydk::is_set(vrf.yfilter) || ydk::is_set(description.yfilter) || (set != nullptr && set->has_operation()); } std::string Native::Crypto::Isakmp::Peer::Hostname::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:isakmp/peer/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Isakmp::Peer::Hostname::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "hostname"; ADD_KEY_TOKEN(name, "name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Peer::Hostname::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (name.is_set || is_set(name.yfilter)) leaf_name_data.push_back(name.get_name_leafdata()); if (vrf.is_set || is_set(vrf.yfilter)) leaf_name_data.push_back(vrf.get_name_leafdata()); if (description.is_set || is_set(description.yfilter)) leaf_name_data.push_back(description.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Peer::Hostname::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "set") { if(set == nullptr) { set = std::make_shared<Native::Crypto::Isakmp::Peer::Hostname::Set>(); } return set; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Peer::Hostname::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(set != nullptr) { _children["set"] = set; } return _children; } void Native::Crypto::Isakmp::Peer::Hostname::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "name") { name = value; name.value_namespace = name_space; name.value_namespace_prefix = name_space_prefix; } if(value_path == "vrf") { vrf = value; vrf.value_namespace = name_space; vrf.value_namespace_prefix = name_space_prefix; } if(value_path == "description") { description = value; description.value_namespace = name_space; description.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Peer::Hostname::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "name") { name.yfilter = yfilter; } if(value_path == "vrf") { vrf.yfilter = yfilter; } if(value_path == "description") { description.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Peer::Hostname::has_leaf_or_child_of_name(const std::string & name) const { if(name == "set" || name == "name" || name == "vrf" || name == "description") return true; return false; } Native::Crypto::Isakmp::Peer::Hostname::Set::Set() : aggressive_mode(std::make_shared<Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode>()) { aggressive_mode->parent = this; yang_name = "set"; yang_parent_name = "hostname"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Peer::Hostname::Set::~Set() { } bool Native::Crypto::Isakmp::Peer::Hostname::Set::has_data() const { if (is_presence_container) return true; return (aggressive_mode != nullptr && aggressive_mode->has_data()); } bool Native::Crypto::Isakmp::Peer::Hostname::Set::has_operation() const { return is_set(yfilter) || (aggressive_mode != nullptr && aggressive_mode->has_operation()); } std::string Native::Crypto::Isakmp::Peer::Hostname::Set::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "set"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Peer::Hostname::Set::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Peer::Hostname::Set::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "aggressive-mode") { if(aggressive_mode == nullptr) { aggressive_mode = std::make_shared<Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode>(); } return aggressive_mode; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Peer::Hostname::Set::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(aggressive_mode != nullptr) { _children["aggressive-mode"] = aggressive_mode; } return _children; } void Native::Crypto::Isakmp::Peer::Hostname::Set::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Isakmp::Peer::Hostname::Set::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Isakmp::Peer::Hostname::Set::has_leaf_or_child_of_name(const std::string & name) const { if(name == "aggressive-mode") return true; return false; } Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::AggressiveMode() : client_endpoint(std::make_shared<Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::ClientEndpoint>()) , password(std::make_shared<Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::Password>()) { client_endpoint->parent = this; password->parent = this; yang_name = "aggressive-mode"; yang_parent_name = "set"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::~AggressiveMode() { } bool Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::has_data() const { if (is_presence_container) return true; return (client_endpoint != nullptr && client_endpoint->has_data()) || (password != nullptr && password->has_data()); } bool Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::has_operation() const { return is_set(yfilter) || (client_endpoint != nullptr && client_endpoint->has_operation()) || (password != nullptr && password->has_operation()); } std::string Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "aggressive-mode"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "client-endpoint") { if(client_endpoint == nullptr) { client_endpoint = std::make_shared<Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::ClientEndpoint>(); } return client_endpoint; } if(child_yang_name == "password") { if(password == nullptr) { password = std::make_shared<Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::Password>(); } return password; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(client_endpoint != nullptr) { _children["client-endpoint"] = client_endpoint; } if(password != nullptr) { _children["password"] = password; } return _children; } void Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::has_leaf_or_child_of_name(const std::string & name) const { if(name == "client-endpoint" || name == "password") return true; return false; } Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::ClientEndpoint::ClientEndpoint() : fqdn{YType::str, "fqdn"}, ipv4_address{YType::str, "ipv4-address"}, ipv6_address{YType::str, "ipv6-address"}, user_fqdn{YType::str, "user-fqdn"} { yang_name = "client-endpoint"; yang_parent_name = "aggressive-mode"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::ClientEndpoint::~ClientEndpoint() { } bool Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::ClientEndpoint::has_data() const { if (is_presence_container) return true; return fqdn.is_set || ipv4_address.is_set || ipv6_address.is_set || user_fqdn.is_set; } bool Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::ClientEndpoint::has_operation() const { return is_set(yfilter) || ydk::is_set(fqdn.yfilter) || ydk::is_set(ipv4_address.yfilter) || ydk::is_set(ipv6_address.yfilter) || ydk::is_set(user_fqdn.yfilter); } std::string Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::ClientEndpoint::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "client-endpoint"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::ClientEndpoint::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (fqdn.is_set || is_set(fqdn.yfilter)) leaf_name_data.push_back(fqdn.get_name_leafdata()); if (ipv4_address.is_set || is_set(ipv4_address.yfilter)) leaf_name_data.push_back(ipv4_address.get_name_leafdata()); if (ipv6_address.is_set || is_set(ipv6_address.yfilter)) leaf_name_data.push_back(ipv6_address.get_name_leafdata()); if (user_fqdn.is_set || is_set(user_fqdn.yfilter)) leaf_name_data.push_back(user_fqdn.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::ClientEndpoint::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::ClientEndpoint::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::ClientEndpoint::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "fqdn") { fqdn = value; fqdn.value_namespace = name_space; fqdn.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv4-address") { ipv4_address = value; ipv4_address.value_namespace = name_space; ipv4_address.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6-address") { ipv6_address = value; ipv6_address.value_namespace = name_space; ipv6_address.value_namespace_prefix = name_space_prefix; } if(value_path == "user-fqdn") { user_fqdn = value; user_fqdn.value_namespace = name_space; user_fqdn.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::ClientEndpoint::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "fqdn") { fqdn.yfilter = yfilter; } if(value_path == "ipv4-address") { ipv4_address.yfilter = yfilter; } if(value_path == "ipv6-address") { ipv6_address.yfilter = yfilter; } if(value_path == "user-fqdn") { user_fqdn.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::ClientEndpoint::has_leaf_or_child_of_name(const std::string & name) const { if(name == "fqdn" || name == "ipv4-address" || name == "ipv6-address" || name == "user-fqdn") return true; return false; } Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::Password::Password() : encryption{YType::enumeration, "encryption"}, key{YType::str, "key"} { yang_name = "password"; yang_parent_name = "aggressive-mode"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::Password::~Password() { } bool Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::Password::has_data() const { if (is_presence_container) return true; return encryption.is_set || key.is_set; } bool Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::Password::has_operation() const { return is_set(yfilter) || ydk::is_set(encryption.yfilter) || ydk::is_set(key.yfilter); } std::string Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::Password::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "password"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::Password::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (encryption.is_set || is_set(encryption.yfilter)) leaf_name_data.push_back(encryption.get_name_leafdata()); if (key.is_set || is_set(key.yfilter)) leaf_name_data.push_back(key.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::Password::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::Password::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::Password::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "encryption") { encryption = value; encryption.value_namespace = name_space; encryption.value_namespace_prefix = name_space_prefix; } if(value_path == "key") { key = value; key.value_namespace = name_space; key.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::Password::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "encryption") { encryption.yfilter = yfilter; } if(value_path == "key") { key.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::Password::has_leaf_or_child_of_name(const std::string & name) const { if(name == "encryption" || name == "key") return true; return false; } Native::Crypto::Isakmp::Policy::Policy() : number{YType::uint32, "number"}, authentication{YType::enumeration, "authentication"}, group{YType::enumeration, "group"}, hash{YType::enumeration, "hash"}, lifetime{YType::uint32, "lifetime"} , default_(std::make_shared<Native::Crypto::Isakmp::Policy::Default>()) , encryption(std::make_shared<Native::Crypto::Isakmp::Policy::Encryption>()) { default_->parent = this; encryption->parent = this; yang_name = "policy"; yang_parent_name = "isakmp"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Isakmp::Policy::~Policy() { } bool Native::Crypto::Isakmp::Policy::has_data() const { if (is_presence_container) return true; return number.is_set || authentication.is_set || group.is_set || hash.is_set || lifetime.is_set || (default_ != nullptr && default_->has_data()) || (encryption != nullptr && encryption->has_data()); } bool Native::Crypto::Isakmp::Policy::has_operation() const { return is_set(yfilter) || ydk::is_set(number.yfilter) || ydk::is_set(authentication.yfilter) || ydk::is_set(group.yfilter) || ydk::is_set(hash.yfilter) || ydk::is_set(lifetime.yfilter) || (default_ != nullptr && default_->has_operation()) || (encryption != nullptr && encryption->has_operation()); } std::string Native::Crypto::Isakmp::Policy::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:isakmp/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Isakmp::Policy::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "policy"; ADD_KEY_TOKEN(number, "number"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Policy::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (number.is_set || is_set(number.yfilter)) leaf_name_data.push_back(number.get_name_leafdata()); if (authentication.is_set || is_set(authentication.yfilter)) leaf_name_data.push_back(authentication.get_name_leafdata()); if (group.is_set || is_set(group.yfilter)) leaf_name_data.push_back(group.get_name_leafdata()); if (hash.is_set || is_set(hash.yfilter)) leaf_name_data.push_back(hash.get_name_leafdata()); if (lifetime.is_set || is_set(lifetime.yfilter)) leaf_name_data.push_back(lifetime.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Policy::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "default") { if(default_ == nullptr) { default_ = std::make_shared<Native::Crypto::Isakmp::Policy::Default>(); } return default_; } if(child_yang_name == "encryption") { if(encryption == nullptr) { encryption = std::make_shared<Native::Crypto::Isakmp::Policy::Encryption>(); } return encryption; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Policy::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(default_ != nullptr) { _children["default"] = default_; } if(encryption != nullptr) { _children["encryption"] = encryption; } return _children; } void Native::Crypto::Isakmp::Policy::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "number") { number = value; number.value_namespace = name_space; number.value_namespace_prefix = name_space_prefix; } if(value_path == "authentication") { authentication = value; authentication.value_namespace = name_space; authentication.value_namespace_prefix = name_space_prefix; } if(value_path == "group") { group = value; group.value_namespace = name_space; group.value_namespace_prefix = name_space_prefix; } if(value_path == "hash") { hash = value; hash.value_namespace = name_space; hash.value_namespace_prefix = name_space_prefix; } if(value_path == "lifetime") { lifetime = value; lifetime.value_namespace = name_space; lifetime.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Policy::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "number") { number.yfilter = yfilter; } if(value_path == "authentication") { authentication.yfilter = yfilter; } if(value_path == "group") { group.yfilter = yfilter; } if(value_path == "hash") { hash.yfilter = yfilter; } if(value_path == "lifetime") { lifetime.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Policy::has_leaf_or_child_of_name(const std::string & name) const { if(name == "default" || name == "encryption" || name == "number" || name == "authentication" || name == "group" || name == "hash" || name == "lifetime") return true; return false; } Native::Crypto::Isakmp::Policy::Default::Default() : authentication{YType::enumeration, "authentication"}, group{YType::enumeration, "group"}, hash{YType::enumeration, "hash"}, lifetime{YType::empty, "lifetime"} , encryption(std::make_shared<Native::Crypto::Isakmp::Policy::Default::Encryption>()) { encryption->parent = this; yang_name = "default"; yang_parent_name = "policy"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Policy::Default::~Default() { } bool Native::Crypto::Isakmp::Policy::Default::has_data() const { if (is_presence_container) return true; return authentication.is_set || group.is_set || hash.is_set || lifetime.is_set || (encryption != nullptr && encryption->has_data()); } bool Native::Crypto::Isakmp::Policy::Default::has_operation() const { return is_set(yfilter) || ydk::is_set(authentication.yfilter) || ydk::is_set(group.yfilter) || ydk::is_set(hash.yfilter) || ydk::is_set(lifetime.yfilter) || (encryption != nullptr && encryption->has_operation()); } std::string Native::Crypto::Isakmp::Policy::Default::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "default"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Policy::Default::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (authentication.is_set || is_set(authentication.yfilter)) leaf_name_data.push_back(authentication.get_name_leafdata()); if (group.is_set || is_set(group.yfilter)) leaf_name_data.push_back(group.get_name_leafdata()); if (hash.is_set || is_set(hash.yfilter)) leaf_name_data.push_back(hash.get_name_leafdata()); if (lifetime.is_set || is_set(lifetime.yfilter)) leaf_name_data.push_back(lifetime.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Policy::Default::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "encryption") { if(encryption == nullptr) { encryption = std::make_shared<Native::Crypto::Isakmp::Policy::Default::Encryption>(); } return encryption; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Policy::Default::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(encryption != nullptr) { _children["encryption"] = encryption; } return _children; } void Native::Crypto::Isakmp::Policy::Default::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "authentication") { authentication = value; authentication.value_namespace = name_space; authentication.value_namespace_prefix = name_space_prefix; } if(value_path == "group") { group = value; group.value_namespace = name_space; group.value_namespace_prefix = name_space_prefix; } if(value_path == "hash") { hash = value; hash.value_namespace = name_space; hash.value_namespace_prefix = name_space_prefix; } if(value_path == "lifetime") { lifetime = value; lifetime.value_namespace = name_space; lifetime.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Policy::Default::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "authentication") { authentication.yfilter = yfilter; } if(value_path == "group") { group.yfilter = yfilter; } if(value_path == "hash") { hash.yfilter = yfilter; } if(value_path == "lifetime") { lifetime.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Policy::Default::has_leaf_or_child_of_name(const std::string & name) const { if(name == "encryption" || name == "authentication" || name == "group" || name == "hash" || name == "lifetime") return true; return false; } Native::Crypto::Isakmp::Policy::Default::Encryption::Encryption() : a3des{YType::empty, "a3des"}, des{YType::empty, "des"} , aes(nullptr) // presence node { yang_name = "encryption"; yang_parent_name = "default"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Policy::Default::Encryption::~Encryption() { } bool Native::Crypto::Isakmp::Policy::Default::Encryption::has_data() const { if (is_presence_container) return true; return a3des.is_set || des.is_set || (aes != nullptr && aes->has_data()); } bool Native::Crypto::Isakmp::Policy::Default::Encryption::has_operation() const { return is_set(yfilter) || ydk::is_set(a3des.yfilter) || ydk::is_set(des.yfilter) || (aes != nullptr && aes->has_operation()); } std::string Native::Crypto::Isakmp::Policy::Default::Encryption::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "encryption"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Policy::Default::Encryption::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (a3des.is_set || is_set(a3des.yfilter)) leaf_name_data.push_back(a3des.get_name_leafdata()); if (des.is_set || is_set(des.yfilter)) leaf_name_data.push_back(des.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Policy::Default::Encryption::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "aes") { if(aes == nullptr) { aes = std::make_shared<Native::Crypto::Isakmp::Policy::Default::Encryption::Aes>(); } return aes; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Policy::Default::Encryption::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(aes != nullptr) { _children["aes"] = aes; } return _children; } void Native::Crypto::Isakmp::Policy::Default::Encryption::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "a3des") { a3des = value; a3des.value_namespace = name_space; a3des.value_namespace_prefix = name_space_prefix; } if(value_path == "des") { des = value; des.value_namespace = name_space; des.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Policy::Default::Encryption::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "a3des") { a3des.yfilter = yfilter; } if(value_path == "des") { des.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Policy::Default::Encryption::has_leaf_or_child_of_name(const std::string & name) const { if(name == "aes" || name == "a3des" || name == "des") return true; return false; } Native::Crypto::Isakmp::Policy::Default::Encryption::Aes::Aes() : key{YType::enumeration, "key"} { yang_name = "aes"; yang_parent_name = "encryption"; is_top_level_class = false; has_list_ancestor = true; is_presence_container = true; } Native::Crypto::Isakmp::Policy::Default::Encryption::Aes::~Aes() { } bool Native::Crypto::Isakmp::Policy::Default::Encryption::Aes::has_data() const { if (is_presence_container) return true; return key.is_set; } bool Native::Crypto::Isakmp::Policy::Default::Encryption::Aes::has_operation() const { return is_set(yfilter) || ydk::is_set(key.yfilter); } std::string Native::Crypto::Isakmp::Policy::Default::Encryption::Aes::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "aes"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Policy::Default::Encryption::Aes::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (key.is_set || is_set(key.yfilter)) leaf_name_data.push_back(key.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Policy::Default::Encryption::Aes::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Policy::Default::Encryption::Aes::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Policy::Default::Encryption::Aes::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "key") { key = value; key.value_namespace = name_space; key.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Policy::Default::Encryption::Aes::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "key") { key.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Policy::Default::Encryption::Aes::has_leaf_or_child_of_name(const std::string & name) const { if(name == "key") return true; return false; } Native::Crypto::Isakmp::Policy::Encryption::Encryption() : a3des{YType::empty, "a3des"}, des{YType::empty, "des"} , aes(nullptr) // presence node { yang_name = "encryption"; yang_parent_name = "policy"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Policy::Encryption::~Encryption() { } bool Native::Crypto::Isakmp::Policy::Encryption::has_data() const { if (is_presence_container) return true; return a3des.is_set || des.is_set || (aes != nullptr && aes->has_data()); } bool Native::Crypto::Isakmp::Policy::Encryption::has_operation() const { return is_set(yfilter) || ydk::is_set(a3des.yfilter) || ydk::is_set(des.yfilter) || (aes != nullptr && aes->has_operation()); } std::string Native::Crypto::Isakmp::Policy::Encryption::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "encryption"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Policy::Encryption::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (a3des.is_set || is_set(a3des.yfilter)) leaf_name_data.push_back(a3des.get_name_leafdata()); if (des.is_set || is_set(des.yfilter)) leaf_name_data.push_back(des.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Policy::Encryption::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "aes") { if(aes == nullptr) { aes = std::make_shared<Native::Crypto::Isakmp::Policy::Encryption::Aes>(); } return aes; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Policy::Encryption::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(aes != nullptr) { _children["aes"] = aes; } return _children; } void Native::Crypto::Isakmp::Policy::Encryption::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "a3des") { a3des = value; a3des.value_namespace = name_space; a3des.value_namespace_prefix = name_space_prefix; } if(value_path == "des") { des = value; des.value_namespace = name_space; des.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Policy::Encryption::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "a3des") { a3des.yfilter = yfilter; } if(value_path == "des") { des.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Policy::Encryption::has_leaf_or_child_of_name(const std::string & name) const { if(name == "aes" || name == "a3des" || name == "des") return true; return false; } Native::Crypto::Isakmp::Policy::Encryption::Aes::Aes() : key{YType::enumeration, "key"} { yang_name = "aes"; yang_parent_name = "encryption"; is_top_level_class = false; has_list_ancestor = true; is_presence_container = true; } Native::Crypto::Isakmp::Policy::Encryption::Aes::~Aes() { } bool Native::Crypto::Isakmp::Policy::Encryption::Aes::has_data() const { if (is_presence_container) return true; return key.is_set; } bool Native::Crypto::Isakmp::Policy::Encryption::Aes::has_operation() const { return is_set(yfilter) || ydk::is_set(key.yfilter); } std::string Native::Crypto::Isakmp::Policy::Encryption::Aes::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "aes"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Policy::Encryption::Aes::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (key.is_set || is_set(key.yfilter)) leaf_name_data.push_back(key.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Policy::Encryption::Aes::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Policy::Encryption::Aes::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Policy::Encryption::Aes::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "key") { key = value; key.value_namespace = name_space; key.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Policy::Encryption::Aes::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "key") { key.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Policy::Encryption::Aes::has_leaf_or_child_of_name(const std::string & name) const { if(name == "key") return true; return false; } Native::Crypto::Isakmp::Profile::Profile() : name{YType::str, "name"}, accounting{YType::str, "accounting"}, description{YType::str, "description"}, keyring{YType::str, "keyring"}, qos_group{YType::uint16, "qos-group"}, virtual_template{YType::uint16, "virtual-template"}, vrf{YType::str, "vrf"} , default_(std::make_shared<Native::Crypto::Isakmp::Profile::Default>()) , ca(std::make_shared<Native::Crypto::Isakmp::Profile::Ca>()) , client(std::make_shared<Native::Crypto::Isakmp::Profile::Client>()) , initiate(std::make_shared<Native::Crypto::Isakmp::Profile::Initiate>()) , isakmp(std::make_shared<Native::Crypto::Isakmp::Profile::Isakmp_>()) , keepalive(std::make_shared<Native::Crypto::Isakmp::Profile::Keepalive>()) , local_address(std::make_shared<Native::Crypto::Isakmp::Profile::LocalAddress>()) , match(std::make_shared<Native::Crypto::Isakmp::Profile::Match>()) , self_identity(std::make_shared<Native::Crypto::Isakmp::Profile::SelfIdentity>()) { default_->parent = this; ca->parent = this; client->parent = this; initiate->parent = this; isakmp->parent = this; keepalive->parent = this; local_address->parent = this; match->parent = this; self_identity->parent = this; yang_name = "profile"; yang_parent_name = "isakmp"; is_top_level_class = false; has_list_ancestor = false; } Native::Crypto::Isakmp::Profile::~Profile() { } bool Native::Crypto::Isakmp::Profile::has_data() const { if (is_presence_container) return true; return name.is_set || accounting.is_set || description.is_set || keyring.is_set || qos_group.is_set || virtual_template.is_set || vrf.is_set || (default_ != nullptr && default_->has_data()) || (ca != nullptr && ca->has_data()) || (client != nullptr && client->has_data()) || (initiate != nullptr && initiate->has_data()) || (isakmp != nullptr && isakmp->has_data()) || (keepalive != nullptr && keepalive->has_data()) || (local_address != nullptr && local_address->has_data()) || (match != nullptr && match->has_data()) || (self_identity != nullptr && self_identity->has_data()); } bool Native::Crypto::Isakmp::Profile::has_operation() const { return is_set(yfilter) || ydk::is_set(name.yfilter) || ydk::is_set(accounting.yfilter) || ydk::is_set(description.yfilter) || ydk::is_set(keyring.yfilter) || ydk::is_set(qos_group.yfilter) || ydk::is_set(virtual_template.yfilter) || ydk::is_set(vrf.yfilter) || (default_ != nullptr && default_->has_operation()) || (ca != nullptr && ca->has_operation()) || (client != nullptr && client->has_operation()) || (initiate != nullptr && initiate->has_operation()) || (isakmp != nullptr && isakmp->has_operation()) || (keepalive != nullptr && keepalive->has_operation()) || (local_address != nullptr && local_address->has_operation()) || (match != nullptr && match->has_operation()) || (self_identity != nullptr && self_identity->has_operation()); } std::string Native::Crypto::Isakmp::Profile::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XE-native:native/crypto/Cisco-IOS-XE-crypto:isakmp/" << get_segment_path(); return path_buffer.str(); } std::string Native::Crypto::Isakmp::Profile::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "profile"; ADD_KEY_TOKEN(name, "name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (name.is_set || is_set(name.yfilter)) leaf_name_data.push_back(name.get_name_leafdata()); if (accounting.is_set || is_set(accounting.yfilter)) leaf_name_data.push_back(accounting.get_name_leafdata()); if (description.is_set || is_set(description.yfilter)) leaf_name_data.push_back(description.get_name_leafdata()); if (keyring.is_set || is_set(keyring.yfilter)) leaf_name_data.push_back(keyring.get_name_leafdata()); if (qos_group.is_set || is_set(qos_group.yfilter)) leaf_name_data.push_back(qos_group.get_name_leafdata()); if (virtual_template.is_set || is_set(virtual_template.yfilter)) leaf_name_data.push_back(virtual_template.get_name_leafdata()); if (vrf.is_set || is_set(vrf.yfilter)) leaf_name_data.push_back(vrf.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "default") { if(default_ == nullptr) { default_ = std::make_shared<Native::Crypto::Isakmp::Profile::Default>(); } return default_; } if(child_yang_name == "ca") { if(ca == nullptr) { ca = std::make_shared<Native::Crypto::Isakmp::Profile::Ca>(); } return ca; } if(child_yang_name == "client") { if(client == nullptr) { client = std::make_shared<Native::Crypto::Isakmp::Profile::Client>(); } return client; } if(child_yang_name == "initiate") { if(initiate == nullptr) { initiate = std::make_shared<Native::Crypto::Isakmp::Profile::Initiate>(); } return initiate; } if(child_yang_name == "isakmp") { if(isakmp == nullptr) { isakmp = std::make_shared<Native::Crypto::Isakmp::Profile::Isakmp_>(); } return isakmp; } if(child_yang_name == "keepalive") { if(keepalive == nullptr) { keepalive = std::make_shared<Native::Crypto::Isakmp::Profile::Keepalive>(); } return keepalive; } if(child_yang_name == "local-address") { if(local_address == nullptr) { local_address = std::make_shared<Native::Crypto::Isakmp::Profile::LocalAddress>(); } return local_address; } if(child_yang_name == "match") { if(match == nullptr) { match = std::make_shared<Native::Crypto::Isakmp::Profile::Match>(); } return match; } if(child_yang_name == "self-identity") { if(self_identity == nullptr) { self_identity = std::make_shared<Native::Crypto::Isakmp::Profile::SelfIdentity>(); } return self_identity; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(default_ != nullptr) { _children["default"] = default_; } if(ca != nullptr) { _children["ca"] = ca; } if(client != nullptr) { _children["client"] = client; } if(initiate != nullptr) { _children["initiate"] = initiate; } if(isakmp != nullptr) { _children["isakmp"] = isakmp; } if(keepalive != nullptr) { _children["keepalive"] = keepalive; } if(local_address != nullptr) { _children["local-address"] = local_address; } if(match != nullptr) { _children["match"] = match; } if(self_identity != nullptr) { _children["self-identity"] = self_identity; } return _children; } void Native::Crypto::Isakmp::Profile::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "name") { name = value; name.value_namespace = name_space; name.value_namespace_prefix = name_space_prefix; } if(value_path == "accounting") { accounting = value; accounting.value_namespace = name_space; accounting.value_namespace_prefix = name_space_prefix; } if(value_path == "description") { description = value; description.value_namespace = name_space; description.value_namespace_prefix = name_space_prefix; } if(value_path == "keyring") { keyring = value; keyring.value_namespace = name_space; keyring.value_namespace_prefix = name_space_prefix; } if(value_path == "qos-group") { qos_group = value; qos_group.value_namespace = name_space; qos_group.value_namespace_prefix = name_space_prefix; } if(value_path == "virtual-template") { virtual_template = value; virtual_template.value_namespace = name_space; virtual_template.value_namespace_prefix = name_space_prefix; } if(value_path == "vrf") { vrf = value; vrf.value_namespace = name_space; vrf.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Profile::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "name") { name.yfilter = yfilter; } if(value_path == "accounting") { accounting.yfilter = yfilter; } if(value_path == "description") { description.yfilter = yfilter; } if(value_path == "keyring") { keyring.yfilter = yfilter; } if(value_path == "qos-group") { qos_group.yfilter = yfilter; } if(value_path == "virtual-template") { virtual_template.yfilter = yfilter; } if(value_path == "vrf") { vrf.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Profile::has_leaf_or_child_of_name(const std::string & name) const { if(name == "default" || name == "ca" || name == "client" || name == "initiate" || name == "isakmp" || name == "keepalive" || name == "local-address" || name == "match" || name == "self-identity" || name == "name" || name == "accounting" || name == "description" || name == "keyring" || name == "qos-group" || name == "virtual-template" || name == "vrf") return true; return false; } Native::Crypto::Isakmp::Profile::Default::Default() : accounting{YType::empty, "accounting"}, description{YType::str, "description"}, keyring{YType::str, "keyring"}, local_address{YType::empty, "local-address"}, qos_group{YType::empty, "qos-group"}, virtual_template{YType::empty, "virtual-template"}, vrf{YType::empty, "vrf"} , ca(std::make_shared<Native::Crypto::Isakmp::Profile::Default::Ca>()) , client(std::make_shared<Native::Crypto::Isakmp::Profile::Default::Client>()) , initiate(std::make_shared<Native::Crypto::Isakmp::Profile::Default::Initiate>()) , isakmp(std::make_shared<Native::Crypto::Isakmp::Profile::Default::Isakmp_>()) , keepalive(nullptr) // presence node , match(std::make_shared<Native::Crypto::Isakmp::Profile::Default::Match>()) , self_identity(nullptr) // presence node { ca->parent = this; client->parent = this; initiate->parent = this; isakmp->parent = this; match->parent = this; yang_name = "default"; yang_parent_name = "profile"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Profile::Default::~Default() { } bool Native::Crypto::Isakmp::Profile::Default::has_data() const { if (is_presence_container) return true; return accounting.is_set || description.is_set || keyring.is_set || local_address.is_set || qos_group.is_set || virtual_template.is_set || vrf.is_set || (ca != nullptr && ca->has_data()) || (client != nullptr && client->has_data()) || (initiate != nullptr && initiate->has_data()) || (isakmp != nullptr && isakmp->has_data()) || (keepalive != nullptr && keepalive->has_data()) || (match != nullptr && match->has_data()) || (self_identity != nullptr && self_identity->has_data()); } bool Native::Crypto::Isakmp::Profile::Default::has_operation() const { return is_set(yfilter) || ydk::is_set(accounting.yfilter) || ydk::is_set(description.yfilter) || ydk::is_set(keyring.yfilter) || ydk::is_set(local_address.yfilter) || ydk::is_set(qos_group.yfilter) || ydk::is_set(virtual_template.yfilter) || ydk::is_set(vrf.yfilter) || (ca != nullptr && ca->has_operation()) || (client != nullptr && client->has_operation()) || (initiate != nullptr && initiate->has_operation()) || (isakmp != nullptr && isakmp->has_operation()) || (keepalive != nullptr && keepalive->has_operation()) || (match != nullptr && match->has_operation()) || (self_identity != nullptr && self_identity->has_operation()); } std::string Native::Crypto::Isakmp::Profile::Default::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "default"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::Default::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (accounting.is_set || is_set(accounting.yfilter)) leaf_name_data.push_back(accounting.get_name_leafdata()); if (description.is_set || is_set(description.yfilter)) leaf_name_data.push_back(description.get_name_leafdata()); if (keyring.is_set || is_set(keyring.yfilter)) leaf_name_data.push_back(keyring.get_name_leafdata()); if (local_address.is_set || is_set(local_address.yfilter)) leaf_name_data.push_back(local_address.get_name_leafdata()); if (qos_group.is_set || is_set(qos_group.yfilter)) leaf_name_data.push_back(qos_group.get_name_leafdata()); if (virtual_template.is_set || is_set(virtual_template.yfilter)) leaf_name_data.push_back(virtual_template.get_name_leafdata()); if (vrf.is_set || is_set(vrf.yfilter)) leaf_name_data.push_back(vrf.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::Default::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "ca") { if(ca == nullptr) { ca = std::make_shared<Native::Crypto::Isakmp::Profile::Default::Ca>(); } return ca; } if(child_yang_name == "client") { if(client == nullptr) { client = std::make_shared<Native::Crypto::Isakmp::Profile::Default::Client>(); } return client; } if(child_yang_name == "initiate") { if(initiate == nullptr) { initiate = std::make_shared<Native::Crypto::Isakmp::Profile::Default::Initiate>(); } return initiate; } if(child_yang_name == "isakmp") { if(isakmp == nullptr) { isakmp = std::make_shared<Native::Crypto::Isakmp::Profile::Default::Isakmp_>(); } return isakmp; } if(child_yang_name == "keepalive") { if(keepalive == nullptr) { keepalive = std::make_shared<Native::Crypto::Isakmp::Profile::Default::Keepalive>(); } return keepalive; } if(child_yang_name == "match") { if(match == nullptr) { match = std::make_shared<Native::Crypto::Isakmp::Profile::Default::Match>(); } return match; } if(child_yang_name == "self-identity") { if(self_identity == nullptr) { self_identity = std::make_shared<Native::Crypto::Isakmp::Profile::Default::SelfIdentity>(); } return self_identity; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::Default::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(ca != nullptr) { _children["ca"] = ca; } if(client != nullptr) { _children["client"] = client; } if(initiate != nullptr) { _children["initiate"] = initiate; } if(isakmp != nullptr) { _children["isakmp"] = isakmp; } if(keepalive != nullptr) { _children["keepalive"] = keepalive; } if(match != nullptr) { _children["match"] = match; } if(self_identity != nullptr) { _children["self-identity"] = self_identity; } return _children; } void Native::Crypto::Isakmp::Profile::Default::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "accounting") { accounting = value; accounting.value_namespace = name_space; accounting.value_namespace_prefix = name_space_prefix; } if(value_path == "description") { description = value; description.value_namespace = name_space; description.value_namespace_prefix = name_space_prefix; } if(value_path == "keyring") { keyring = value; keyring.value_namespace = name_space; keyring.value_namespace_prefix = name_space_prefix; } if(value_path == "local-address") { local_address = value; local_address.value_namespace = name_space; local_address.value_namespace_prefix = name_space_prefix; } if(value_path == "qos-group") { qos_group = value; qos_group.value_namespace = name_space; qos_group.value_namespace_prefix = name_space_prefix; } if(value_path == "virtual-template") { virtual_template = value; virtual_template.value_namespace = name_space; virtual_template.value_namespace_prefix = name_space_prefix; } if(value_path == "vrf") { vrf = value; vrf.value_namespace = name_space; vrf.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Profile::Default::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "accounting") { accounting.yfilter = yfilter; } if(value_path == "description") { description.yfilter = yfilter; } if(value_path == "keyring") { keyring.yfilter = yfilter; } if(value_path == "local-address") { local_address.yfilter = yfilter; } if(value_path == "qos-group") { qos_group.yfilter = yfilter; } if(value_path == "virtual-template") { virtual_template.yfilter = yfilter; } if(value_path == "vrf") { vrf.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Profile::Default::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ca" || name == "client" || name == "initiate" || name == "isakmp" || name == "keepalive" || name == "match" || name == "self-identity" || name == "accounting" || name == "description" || name == "keyring" || name == "local-address" || name == "qos-group" || name == "virtual-template" || name == "vrf") return true; return false; } Native::Crypto::Isakmp::Profile::Default::Ca::Ca() : trust_point{YType::str, "trust-point"} { yang_name = "ca"; yang_parent_name = "default"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Profile::Default::Ca::~Ca() { } bool Native::Crypto::Isakmp::Profile::Default::Ca::has_data() const { if (is_presence_container) return true; return trust_point.is_set; } bool Native::Crypto::Isakmp::Profile::Default::Ca::has_operation() const { return is_set(yfilter) || ydk::is_set(trust_point.yfilter); } std::string Native::Crypto::Isakmp::Profile::Default::Ca::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ca"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::Default::Ca::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (trust_point.is_set || is_set(trust_point.yfilter)) leaf_name_data.push_back(trust_point.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::Default::Ca::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::Default::Ca::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Profile::Default::Ca::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "trust-point") { trust_point = value; trust_point.value_namespace = name_space; trust_point.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Profile::Default::Ca::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "trust-point") { trust_point.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Profile::Default::Ca::has_leaf_or_child_of_name(const std::string & name) const { if(name == "trust-point") return true; return false; } Native::Crypto::Isakmp::Profile::Default::Client::Client() : authentication(std::make_shared<Native::Crypto::Isakmp::Profile::Default::Client::Authentication>()) , configuration(std::make_shared<Native::Crypto::Isakmp::Profile::Default::Client::Configuration>()) , pki(std::make_shared<Native::Crypto::Isakmp::Profile::Default::Client::Pki>()) { authentication->parent = this; configuration->parent = this; pki->parent = this; yang_name = "client"; yang_parent_name = "default"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Profile::Default::Client::~Client() { } bool Native::Crypto::Isakmp::Profile::Default::Client::has_data() const { if (is_presence_container) return true; return (authentication != nullptr && authentication->has_data()) || (configuration != nullptr && configuration->has_data()) || (pki != nullptr && pki->has_data()); } bool Native::Crypto::Isakmp::Profile::Default::Client::has_operation() const { return is_set(yfilter) || (authentication != nullptr && authentication->has_operation()) || (configuration != nullptr && configuration->has_operation()) || (pki != nullptr && pki->has_operation()); } std::string Native::Crypto::Isakmp::Profile::Default::Client::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "client"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::Default::Client::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::Default::Client::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "authentication") { if(authentication == nullptr) { authentication = std::make_shared<Native::Crypto::Isakmp::Profile::Default::Client::Authentication>(); } return authentication; } if(child_yang_name == "configuration") { if(configuration == nullptr) { configuration = std::make_shared<Native::Crypto::Isakmp::Profile::Default::Client::Configuration>(); } return configuration; } if(child_yang_name == "pki") { if(pki == nullptr) { pki = std::make_shared<Native::Crypto::Isakmp::Profile::Default::Client::Pki>(); } return pki; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::Default::Client::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(authentication != nullptr) { _children["authentication"] = authentication; } if(configuration != nullptr) { _children["configuration"] = configuration; } if(pki != nullptr) { _children["pki"] = pki; } return _children; } void Native::Crypto::Isakmp::Profile::Default::Client::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Isakmp::Profile::Default::Client::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Isakmp::Profile::Default::Client::has_leaf_or_child_of_name(const std::string & name) const { if(name == "authentication" || name == "configuration" || name == "pki") return true; return false; } Native::Crypto::Isakmp::Profile::Default::Client::Authentication::Authentication() : list{YType::empty, "list"} { yang_name = "authentication"; yang_parent_name = "client"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Profile::Default::Client::Authentication::~Authentication() { } bool Native::Crypto::Isakmp::Profile::Default::Client::Authentication::has_data() const { if (is_presence_container) return true; return list.is_set; } bool Native::Crypto::Isakmp::Profile::Default::Client::Authentication::has_operation() const { return is_set(yfilter) || ydk::is_set(list.yfilter); } std::string Native::Crypto::Isakmp::Profile::Default::Client::Authentication::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "authentication"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::Default::Client::Authentication::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (list.is_set || is_set(list.yfilter)) leaf_name_data.push_back(list.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::Default::Client::Authentication::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::Default::Client::Authentication::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Profile::Default::Client::Authentication::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "list") { list = value; list.value_namespace = name_space; list.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Profile::Default::Client::Authentication::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "list") { list.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Profile::Default::Client::Authentication::has_leaf_or_child_of_name(const std::string & name) const { if(name == "list") return true; return false; } Native::Crypto::Isakmp::Profile::Default::Client::Configuration::Configuration() : address{YType::enumeration, "address"}, group{YType::str, "group"} { yang_name = "configuration"; yang_parent_name = "client"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Profile::Default::Client::Configuration::~Configuration() { } bool Native::Crypto::Isakmp::Profile::Default::Client::Configuration::has_data() const { if (is_presence_container) return true; return address.is_set || group.is_set; } bool Native::Crypto::Isakmp::Profile::Default::Client::Configuration::has_operation() const { return is_set(yfilter) || ydk::is_set(address.yfilter) || ydk::is_set(group.yfilter); } std::string Native::Crypto::Isakmp::Profile::Default::Client::Configuration::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "configuration"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::Default::Client::Configuration::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (address.is_set || is_set(address.yfilter)) leaf_name_data.push_back(address.get_name_leafdata()); if (group.is_set || is_set(group.yfilter)) leaf_name_data.push_back(group.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::Default::Client::Configuration::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::Default::Client::Configuration::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Profile::Default::Client::Configuration::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "address") { address = value; address.value_namespace = name_space; address.value_namespace_prefix = name_space_prefix; } if(value_path == "group") { group = value; group.value_namespace = name_space; group.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Profile::Default::Client::Configuration::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "address") { address.yfilter = yfilter; } if(value_path == "group") { group.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Profile::Default::Client::Configuration::has_leaf_or_child_of_name(const std::string & name) const { if(name == "address" || name == "group") return true; return false; } Native::Crypto::Isakmp::Profile::Default::Client::Pki::Pki() : authorization(nullptr) // presence node { yang_name = "pki"; yang_parent_name = "client"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Profile::Default::Client::Pki::~Pki() { } bool Native::Crypto::Isakmp::Profile::Default::Client::Pki::has_data() const { if (is_presence_container) return true; return (authorization != nullptr && authorization->has_data()); } bool Native::Crypto::Isakmp::Profile::Default::Client::Pki::has_operation() const { return is_set(yfilter) || (authorization != nullptr && authorization->has_operation()); } std::string Native::Crypto::Isakmp::Profile::Default::Client::Pki::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "pki"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::Default::Client::Pki::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::Default::Client::Pki::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "authorization") { if(authorization == nullptr) { authorization = std::make_shared<Native::Crypto::Isakmp::Profile::Default::Client::Pki::Authorization>(); } return authorization; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::Default::Client::Pki::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(authorization != nullptr) { _children["authorization"] = authorization; } return _children; } void Native::Crypto::Isakmp::Profile::Default::Client::Pki::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Isakmp::Profile::Default::Client::Pki::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Isakmp::Profile::Default::Client::Pki::has_leaf_or_child_of_name(const std::string & name) const { if(name == "authorization") return true; return false; } Native::Crypto::Isakmp::Profile::Default::Client::Pki::Authorization::Authorization() { yang_name = "authorization"; yang_parent_name = "pki"; is_top_level_class = false; has_list_ancestor = true; is_presence_container = true; } Native::Crypto::Isakmp::Profile::Default::Client::Pki::Authorization::~Authorization() { } bool Native::Crypto::Isakmp::Profile::Default::Client::Pki::Authorization::has_data() const { if (is_presence_container) return true; return false; } bool Native::Crypto::Isakmp::Profile::Default::Client::Pki::Authorization::has_operation() const { return is_set(yfilter); } std::string Native::Crypto::Isakmp::Profile::Default::Client::Pki::Authorization::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "authorization"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::Default::Client::Pki::Authorization::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::Default::Client::Pki::Authorization::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::Default::Client::Pki::Authorization::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Profile::Default::Client::Pki::Authorization::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Isakmp::Profile::Default::Client::Pki::Authorization::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Isakmp::Profile::Default::Client::Pki::Authorization::has_leaf_or_child_of_name(const std::string & name) const { return false; } Native::Crypto::Isakmp::Profile::Default::Initiate::Initiate() : mode(nullptr) // presence node { yang_name = "initiate"; yang_parent_name = "default"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Profile::Default::Initiate::~Initiate() { } bool Native::Crypto::Isakmp::Profile::Default::Initiate::has_data() const { if (is_presence_container) return true; return (mode != nullptr && mode->has_data()); } bool Native::Crypto::Isakmp::Profile::Default::Initiate::has_operation() const { return is_set(yfilter) || (mode != nullptr && mode->has_operation()); } std::string Native::Crypto::Isakmp::Profile::Default::Initiate::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "initiate"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::Default::Initiate::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::Default::Initiate::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "mode") { if(mode == nullptr) { mode = std::make_shared<Native::Crypto::Isakmp::Profile::Default::Initiate::Mode>(); } return mode; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::Default::Initiate::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(mode != nullptr) { _children["mode"] = mode; } return _children; } void Native::Crypto::Isakmp::Profile::Default::Initiate::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Isakmp::Profile::Default::Initiate::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Isakmp::Profile::Default::Initiate::has_leaf_or_child_of_name(const std::string & name) const { if(name == "mode") return true; return false; } Native::Crypto::Isakmp::Profile::Default::Initiate::Mode::Mode() { yang_name = "mode"; yang_parent_name = "initiate"; is_top_level_class = false; has_list_ancestor = true; is_presence_container = true; } Native::Crypto::Isakmp::Profile::Default::Initiate::Mode::~Mode() { } bool Native::Crypto::Isakmp::Profile::Default::Initiate::Mode::has_data() const { if (is_presence_container) return true; return false; } bool Native::Crypto::Isakmp::Profile::Default::Initiate::Mode::has_operation() const { return is_set(yfilter); } std::string Native::Crypto::Isakmp::Profile::Default::Initiate::Mode::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "mode"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::Default::Initiate::Mode::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::Default::Initiate::Mode::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::Default::Initiate::Mode::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Profile::Default::Initiate::Mode::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Isakmp::Profile::Default::Initiate::Mode::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Isakmp::Profile::Default::Initiate::Mode::has_leaf_or_child_of_name(const std::string & name) const { return false; } Native::Crypto::Isakmp::Profile::Default::Isakmp_::Isakmp_() : authorization(std::make_shared<Native::Crypto::Isakmp::Profile::Default::Isakmp_::Authorization>()) { authorization->parent = this; yang_name = "isakmp"; yang_parent_name = "default"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Profile::Default::Isakmp_::~Isakmp_() { } bool Native::Crypto::Isakmp::Profile::Default::Isakmp_::has_data() const { if (is_presence_container) return true; return (authorization != nullptr && authorization->has_data()); } bool Native::Crypto::Isakmp::Profile::Default::Isakmp_::has_operation() const { return is_set(yfilter) || (authorization != nullptr && authorization->has_operation()); } std::string Native::Crypto::Isakmp::Profile::Default::Isakmp_::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "isakmp"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::Default::Isakmp_::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::Default::Isakmp_::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "authorization") { if(authorization == nullptr) { authorization = std::make_shared<Native::Crypto::Isakmp::Profile::Default::Isakmp_::Authorization>(); } return authorization; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::Default::Isakmp_::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(authorization != nullptr) { _children["authorization"] = authorization; } return _children; } void Native::Crypto::Isakmp::Profile::Default::Isakmp_::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Isakmp::Profile::Default::Isakmp_::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Isakmp::Profile::Default::Isakmp_::has_leaf_or_child_of_name(const std::string & name) const { if(name == "authorization") return true; return false; } Native::Crypto::Isakmp::Profile::Default::Isakmp_::Authorization::Authorization() : list{YType::empty, "list"} { yang_name = "authorization"; yang_parent_name = "isakmp"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Profile::Default::Isakmp_::Authorization::~Authorization() { } bool Native::Crypto::Isakmp::Profile::Default::Isakmp_::Authorization::has_data() const { if (is_presence_container) return true; return list.is_set; } bool Native::Crypto::Isakmp::Profile::Default::Isakmp_::Authorization::has_operation() const { return is_set(yfilter) || ydk::is_set(list.yfilter); } std::string Native::Crypto::Isakmp::Profile::Default::Isakmp_::Authorization::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "authorization"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::Default::Isakmp_::Authorization::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (list.is_set || is_set(list.yfilter)) leaf_name_data.push_back(list.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::Default::Isakmp_::Authorization::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::Default::Isakmp_::Authorization::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Profile::Default::Isakmp_::Authorization::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "list") { list = value; list.value_namespace = name_space; list.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Profile::Default::Isakmp_::Authorization::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "list") { list.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Profile::Default::Isakmp_::Authorization::has_leaf_or_child_of_name(const std::string & name) const { if(name == "list") return true; return false; } Native::Crypto::Isakmp::Profile::Default::Keepalive::Keepalive() { yang_name = "keepalive"; yang_parent_name = "default"; is_top_level_class = false; has_list_ancestor = true; is_presence_container = true; } Native::Crypto::Isakmp::Profile::Default::Keepalive::~Keepalive() { } bool Native::Crypto::Isakmp::Profile::Default::Keepalive::has_data() const { if (is_presence_container) return true; return false; } bool Native::Crypto::Isakmp::Profile::Default::Keepalive::has_operation() const { return is_set(yfilter); } std::string Native::Crypto::Isakmp::Profile::Default::Keepalive::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "keepalive"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::Default::Keepalive::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::Default::Keepalive::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::Default::Keepalive::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Profile::Default::Keepalive::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Isakmp::Profile::Default::Keepalive::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Isakmp::Profile::Default::Keepalive::has_leaf_or_child_of_name(const std::string & name) const { return false; } Native::Crypto::Isakmp::Profile::Default::Match::Match() : certificate{YType::str, "certificate"} , identity(std::make_shared<Native::Crypto::Isakmp::Profile::Default::Match::Identity>()) { identity->parent = this; yang_name = "match"; yang_parent_name = "default"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Profile::Default::Match::~Match() { } bool Native::Crypto::Isakmp::Profile::Default::Match::has_data() const { if (is_presence_container) return true; return certificate.is_set || (identity != nullptr && identity->has_data()); } bool Native::Crypto::Isakmp::Profile::Default::Match::has_operation() const { return is_set(yfilter) || ydk::is_set(certificate.yfilter) || (identity != nullptr && identity->has_operation()); } std::string Native::Crypto::Isakmp::Profile::Default::Match::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "match"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::Default::Match::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (certificate.is_set || is_set(certificate.yfilter)) leaf_name_data.push_back(certificate.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::Default::Match::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "identity") { if(identity == nullptr) { identity = std::make_shared<Native::Crypto::Isakmp::Profile::Default::Match::Identity>(); } return identity; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::Default::Match::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(identity != nullptr) { _children["identity"] = identity; } return _children; } void Native::Crypto::Isakmp::Profile::Default::Match::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "certificate") { certificate = value; certificate.value_namespace = name_space; certificate.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Profile::Default::Match::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "certificate") { certificate.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Profile::Default::Match::has_leaf_or_child_of_name(const std::string & name) const { if(name == "identity" || name == "certificate") return true; return false; } Native::Crypto::Isakmp::Profile::Default::Match::Identity::Identity() : group{YType::str, "group"} , ipv4_address(std::make_shared<Native::Crypto::Isakmp::Profile::Default::Match::Identity::Ipv4Address>()) , address(std::make_shared<Native::Crypto::Isakmp::Profile::Default::Match::Identity::Address>()) , host(std::make_shared<Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host>()) , user_fqdn(std::make_shared<Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn>()) { ipv4_address->parent = this; address->parent = this; host->parent = this; user_fqdn->parent = this; yang_name = "identity"; yang_parent_name = "match"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Profile::Default::Match::Identity::~Identity() { } bool Native::Crypto::Isakmp::Profile::Default::Match::Identity::has_data() const { if (is_presence_container) return true; return group.is_set || (ipv4_address != nullptr && ipv4_address->has_data()) || (address != nullptr && address->has_data()) || (host != nullptr && host->has_data()) || (user_fqdn != nullptr && user_fqdn->has_data()); } bool Native::Crypto::Isakmp::Profile::Default::Match::Identity::has_operation() const { return is_set(yfilter) || ydk::is_set(group.yfilter) || (ipv4_address != nullptr && ipv4_address->has_operation()) || (address != nullptr && address->has_operation()) || (host != nullptr && host->has_operation()) || (user_fqdn != nullptr && user_fqdn->has_operation()); } std::string Native::Crypto::Isakmp::Profile::Default::Match::Identity::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "identity"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::Default::Match::Identity::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (group.is_set || is_set(group.yfilter)) leaf_name_data.push_back(group.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::Default::Match::Identity::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "ipv4-address") { if(ipv4_address == nullptr) { ipv4_address = std::make_shared<Native::Crypto::Isakmp::Profile::Default::Match::Identity::Ipv4Address>(); } return ipv4_address; } if(child_yang_name == "address") { if(address == nullptr) { address = std::make_shared<Native::Crypto::Isakmp::Profile::Default::Match::Identity::Address>(); } return address; } if(child_yang_name == "host") { if(host == nullptr) { host = std::make_shared<Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host>(); } return host; } if(child_yang_name == "user-fqdn") { if(user_fqdn == nullptr) { user_fqdn = std::make_shared<Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn>(); } return user_fqdn; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::Default::Match::Identity::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(ipv4_address != nullptr) { _children["ipv4-address"] = ipv4_address; } if(address != nullptr) { _children["address"] = address; } if(host != nullptr) { _children["host"] = host; } if(user_fqdn != nullptr) { _children["user-fqdn"] = user_fqdn; } return _children; } void Native::Crypto::Isakmp::Profile::Default::Match::Identity::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "group") { group = value; group.value_namespace = name_space; group.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Profile::Default::Match::Identity::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "group") { group.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Profile::Default::Match::Identity::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipv4-address" || name == "address" || name == "host" || name == "user-fqdn" || name == "group") return true; return false; } Native::Crypto::Isakmp::Profile::Default::Match::Identity::Ipv4Address::Ipv4Address() : address{YType::str, "address"}, mask{YType::str, "mask"}, vrf{YType::str, "vrf"} { yang_name = "ipv4-address"; yang_parent_name = "identity"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Profile::Default::Match::Identity::Ipv4Address::~Ipv4Address() { } bool Native::Crypto::Isakmp::Profile::Default::Match::Identity::Ipv4Address::has_data() const { if (is_presence_container) return true; return address.is_set || mask.is_set || vrf.is_set; } bool Native::Crypto::Isakmp::Profile::Default::Match::Identity::Ipv4Address::has_operation() const { return is_set(yfilter) || ydk::is_set(address.yfilter) || ydk::is_set(mask.yfilter) || ydk::is_set(vrf.yfilter); } std::string Native::Crypto::Isakmp::Profile::Default::Match::Identity::Ipv4Address::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipv4-address"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::Default::Match::Identity::Ipv4Address::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (address.is_set || is_set(address.yfilter)) leaf_name_data.push_back(address.get_name_leafdata()); if (mask.is_set || is_set(mask.yfilter)) leaf_name_data.push_back(mask.get_name_leafdata()); if (vrf.is_set || is_set(vrf.yfilter)) leaf_name_data.push_back(vrf.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::Default::Match::Identity::Ipv4Address::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::Default::Match::Identity::Ipv4Address::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Profile::Default::Match::Identity::Ipv4Address::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "address") { address = value; address.value_namespace = name_space; address.value_namespace_prefix = name_space_prefix; } if(value_path == "mask") { mask = value; mask.value_namespace = name_space; mask.value_namespace_prefix = name_space_prefix; } if(value_path == "vrf") { vrf = value; vrf.value_namespace = name_space; vrf.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Profile::Default::Match::Identity::Ipv4Address::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "address") { address.yfilter = yfilter; } if(value_path == "mask") { mask.yfilter = yfilter; } if(value_path == "vrf") { vrf.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Profile::Default::Match::Identity::Ipv4Address::has_leaf_or_child_of_name(const std::string & name) const { if(name == "address" || name == "mask" || name == "vrf") return true; return false; } Native::Crypto::Isakmp::Profile::Default::Match::Identity::Address::Address() : ipv6{YType::str, "ipv6"}, vrf{YType::str, "vrf"} { yang_name = "address"; yang_parent_name = "identity"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Profile::Default::Match::Identity::Address::~Address() { } bool Native::Crypto::Isakmp::Profile::Default::Match::Identity::Address::has_data() const { if (is_presence_container) return true; return ipv6.is_set || vrf.is_set; } bool Native::Crypto::Isakmp::Profile::Default::Match::Identity::Address::has_operation() const { return is_set(yfilter) || ydk::is_set(ipv6.yfilter) || ydk::is_set(vrf.yfilter); } std::string Native::Crypto::Isakmp::Profile::Default::Match::Identity::Address::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "address"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::Default::Match::Identity::Address::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (ipv6.is_set || is_set(ipv6.yfilter)) leaf_name_data.push_back(ipv6.get_name_leafdata()); if (vrf.is_set || is_set(vrf.yfilter)) leaf_name_data.push_back(vrf.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::Default::Match::Identity::Address::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::Default::Match::Identity::Address::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Profile::Default::Match::Identity::Address::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "ipv6") { ipv6 = value; ipv6.value_namespace = name_space; ipv6.value_namespace_prefix = name_space_prefix; } if(value_path == "vrf") { vrf = value; vrf.value_namespace = name_space; vrf.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Profile::Default::Match::Identity::Address::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ipv6") { ipv6.yfilter = yfilter; } if(value_path == "vrf") { vrf.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Profile::Default::Match::Identity::Address::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipv6" || name == "vrf") return true; return false; } Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::Host() : domain_name(std::make_shared<Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::DomainName>()) , domain_match(std::make_shared<Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::DomainMatch>()) { domain_name->parent = this; domain_match->parent = this; yang_name = "host"; yang_parent_name = "identity"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::~Host() { } bool Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::has_data() const { if (is_presence_container) return true; return (domain_name != nullptr && domain_name->has_data()) || (domain_match != nullptr && domain_match->has_data()); } bool Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::has_operation() const { return is_set(yfilter) || (domain_name != nullptr && domain_name->has_operation()) || (domain_match != nullptr && domain_match->has_operation()); } std::string Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "host"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "domain-name") { if(domain_name == nullptr) { domain_name = std::make_shared<Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::DomainName>(); } return domain_name; } if(child_yang_name == "domain-match") { if(domain_match == nullptr) { domain_match = std::make_shared<Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::DomainMatch>(); } return domain_match; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(domain_name != nullptr) { _children["domain-name"] = domain_name; } if(domain_match != nullptr) { _children["domain-match"] = domain_match; } return _children; } void Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::has_leaf_or_child_of_name(const std::string & name) const { if(name == "domain-name" || name == "domain-match") return true; return false; } Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::DomainName::DomainName() : name{YType::str, "name"}, vrf{YType::str, "vrf"} { yang_name = "domain-name"; yang_parent_name = "host"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::DomainName::~DomainName() { } bool Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::DomainName::has_data() const { if (is_presence_container) return true; return name.is_set || vrf.is_set; } bool Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::DomainName::has_operation() const { return is_set(yfilter) || ydk::is_set(name.yfilter) || ydk::is_set(vrf.yfilter); } std::string Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::DomainName::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "domain-name"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::DomainName::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (name.is_set || is_set(name.yfilter)) leaf_name_data.push_back(name.get_name_leafdata()); if (vrf.is_set || is_set(vrf.yfilter)) leaf_name_data.push_back(vrf.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::DomainName::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::DomainName::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::DomainName::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "name") { name = value; name.value_namespace = name_space; name.value_namespace_prefix = name_space_prefix; } if(value_path == "vrf") { vrf = value; vrf.value_namespace = name_space; vrf.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::DomainName::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "name") { name.yfilter = yfilter; } if(value_path == "vrf") { vrf.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::DomainName::has_leaf_or_child_of_name(const std::string & name) const { if(name == "name" || name == "vrf") return true; return false; } Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::DomainMatch::DomainMatch() : domain{YType::str, "domain"}, vrf{YType::str, "vrf"} { yang_name = "domain-match"; yang_parent_name = "host"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::DomainMatch::~DomainMatch() { } bool Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::DomainMatch::has_data() const { if (is_presence_container) return true; return domain.is_set || vrf.is_set; } bool Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::DomainMatch::has_operation() const { return is_set(yfilter) || ydk::is_set(domain.yfilter) || ydk::is_set(vrf.yfilter); } std::string Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::DomainMatch::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "domain-match"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::DomainMatch::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (domain.is_set || is_set(domain.yfilter)) leaf_name_data.push_back(domain.get_name_leafdata()); if (vrf.is_set || is_set(vrf.yfilter)) leaf_name_data.push_back(vrf.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::DomainMatch::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::DomainMatch::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::DomainMatch::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "domain") { domain = value; domain.value_namespace = name_space; domain.value_namespace_prefix = name_space_prefix; } if(value_path == "vrf") { vrf = value; vrf.value_namespace = name_space; vrf.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::DomainMatch::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "domain") { domain.yfilter = yfilter; } if(value_path == "vrf") { vrf.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Profile::Default::Match::Identity::Host::DomainMatch::has_leaf_or_child_of_name(const std::string & name) const { if(name == "domain" || name == "vrf") return true; return false; } Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::UserFqdn() : domain_name(std::make_shared<Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::DomainName>()) , domain_match(std::make_shared<Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::DomainMatch>()) { domain_name->parent = this; domain_match->parent = this; yang_name = "user-fqdn"; yang_parent_name = "identity"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::~UserFqdn() { } bool Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::has_data() const { if (is_presence_container) return true; return (domain_name != nullptr && domain_name->has_data()) || (domain_match != nullptr && domain_match->has_data()); } bool Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::has_operation() const { return is_set(yfilter) || (domain_name != nullptr && domain_name->has_operation()) || (domain_match != nullptr && domain_match->has_operation()); } std::string Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "user-fqdn"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "domain-name") { if(domain_name == nullptr) { domain_name = std::make_shared<Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::DomainName>(); } return domain_name; } if(child_yang_name == "domain-match") { if(domain_match == nullptr) { domain_match = std::make_shared<Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::DomainMatch>(); } return domain_match; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(domain_name != nullptr) { _children["domain-name"] = domain_name; } if(domain_match != nullptr) { _children["domain-match"] = domain_match; } return _children; } void Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::has_leaf_or_child_of_name(const std::string & name) const { if(name == "domain-name" || name == "domain-match") return true; return false; } Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::DomainName::DomainName() : name{YType::str, "name"}, vrf{YType::str, "vrf"} { yang_name = "domain-name"; yang_parent_name = "user-fqdn"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::DomainName::~DomainName() { } bool Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::DomainName::has_data() const { if (is_presence_container) return true; return name.is_set || vrf.is_set; } bool Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::DomainName::has_operation() const { return is_set(yfilter) || ydk::is_set(name.yfilter) || ydk::is_set(vrf.yfilter); } std::string Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::DomainName::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "domain-name"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::DomainName::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (name.is_set || is_set(name.yfilter)) leaf_name_data.push_back(name.get_name_leafdata()); if (vrf.is_set || is_set(vrf.yfilter)) leaf_name_data.push_back(vrf.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::DomainName::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::DomainName::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::DomainName::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "name") { name = value; name.value_namespace = name_space; name.value_namespace_prefix = name_space_prefix; } if(value_path == "vrf") { vrf = value; vrf.value_namespace = name_space; vrf.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::DomainName::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "name") { name.yfilter = yfilter; } if(value_path == "vrf") { vrf.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::DomainName::has_leaf_or_child_of_name(const std::string & name) const { if(name == "name" || name == "vrf") return true; return false; } Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::DomainMatch::DomainMatch() : domain{YType::str, "domain"}, vrf{YType::str, "vrf"} { yang_name = "domain-match"; yang_parent_name = "user-fqdn"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::DomainMatch::~DomainMatch() { } bool Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::DomainMatch::has_data() const { if (is_presence_container) return true; return domain.is_set || vrf.is_set; } bool Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::DomainMatch::has_operation() const { return is_set(yfilter) || ydk::is_set(domain.yfilter) || ydk::is_set(vrf.yfilter); } std::string Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::DomainMatch::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "domain-match"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::DomainMatch::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (domain.is_set || is_set(domain.yfilter)) leaf_name_data.push_back(domain.get_name_leafdata()); if (vrf.is_set || is_set(vrf.yfilter)) leaf_name_data.push_back(vrf.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::DomainMatch::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::DomainMatch::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::DomainMatch::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "domain") { domain = value; domain.value_namespace = name_space; domain.value_namespace_prefix = name_space_prefix; } if(value_path == "vrf") { vrf = value; vrf.value_namespace = name_space; vrf.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::DomainMatch::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "domain") { domain.yfilter = yfilter; } if(value_path == "vrf") { vrf.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Profile::Default::Match::Identity::UserFqdn::DomainMatch::has_leaf_or_child_of_name(const std::string & name) const { if(name == "domain" || name == "vrf") return true; return false; } Native::Crypto::Isakmp::Profile::Default::SelfIdentity::SelfIdentity() { yang_name = "self-identity"; yang_parent_name = "default"; is_top_level_class = false; has_list_ancestor = true; is_presence_container = true; } Native::Crypto::Isakmp::Profile::Default::SelfIdentity::~SelfIdentity() { } bool Native::Crypto::Isakmp::Profile::Default::SelfIdentity::has_data() const { if (is_presence_container) return true; return false; } bool Native::Crypto::Isakmp::Profile::Default::SelfIdentity::has_operation() const { return is_set(yfilter); } std::string Native::Crypto::Isakmp::Profile::Default::SelfIdentity::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "self-identity"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::Default::SelfIdentity::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::Default::SelfIdentity::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::Default::SelfIdentity::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Profile::Default::SelfIdentity::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Isakmp::Profile::Default::SelfIdentity::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Isakmp::Profile::Default::SelfIdentity::has_leaf_or_child_of_name(const std::string & name) const { return false; } Native::Crypto::Isakmp::Profile::Ca::Ca() : trust_point{YType::str, "trust-point"} { yang_name = "ca"; yang_parent_name = "profile"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Profile::Ca::~Ca() { } bool Native::Crypto::Isakmp::Profile::Ca::has_data() const { if (is_presence_container) return true; return trust_point.is_set; } bool Native::Crypto::Isakmp::Profile::Ca::has_operation() const { return is_set(yfilter) || ydk::is_set(trust_point.yfilter); } std::string Native::Crypto::Isakmp::Profile::Ca::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ca"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::Ca::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (trust_point.is_set || is_set(trust_point.yfilter)) leaf_name_data.push_back(trust_point.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::Ca::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::Ca::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Profile::Ca::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "trust-point") { trust_point = value; trust_point.value_namespace = name_space; trust_point.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Profile::Ca::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "trust-point") { trust_point.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Profile::Ca::has_leaf_or_child_of_name(const std::string & name) const { if(name == "trust-point") return true; return false; } Native::Crypto::Isakmp::Profile::Client::Client() : authentication(std::make_shared<Native::Crypto::Isakmp::Profile::Client::Authentication>()) , configuration(std::make_shared<Native::Crypto::Isakmp::Profile::Client::Configuration>()) , pki(std::make_shared<Native::Crypto::Isakmp::Profile::Client::Pki>()) { authentication->parent = this; configuration->parent = this; pki->parent = this; yang_name = "client"; yang_parent_name = "profile"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Profile::Client::~Client() { } bool Native::Crypto::Isakmp::Profile::Client::has_data() const { if (is_presence_container) return true; return (authentication != nullptr && authentication->has_data()) || (configuration != nullptr && configuration->has_data()) || (pki != nullptr && pki->has_data()); } bool Native::Crypto::Isakmp::Profile::Client::has_operation() const { return is_set(yfilter) || (authentication != nullptr && authentication->has_operation()) || (configuration != nullptr && configuration->has_operation()) || (pki != nullptr && pki->has_operation()); } std::string Native::Crypto::Isakmp::Profile::Client::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "client"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::Client::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::Client::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "authentication") { if(authentication == nullptr) { authentication = std::make_shared<Native::Crypto::Isakmp::Profile::Client::Authentication>(); } return authentication; } if(child_yang_name == "configuration") { if(configuration == nullptr) { configuration = std::make_shared<Native::Crypto::Isakmp::Profile::Client::Configuration>(); } return configuration; } if(child_yang_name == "pki") { if(pki == nullptr) { pki = std::make_shared<Native::Crypto::Isakmp::Profile::Client::Pki>(); } return pki; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::Client::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(authentication != nullptr) { _children["authentication"] = authentication; } if(configuration != nullptr) { _children["configuration"] = configuration; } if(pki != nullptr) { _children["pki"] = pki; } return _children; } void Native::Crypto::Isakmp::Profile::Client::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Isakmp::Profile::Client::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Isakmp::Profile::Client::has_leaf_or_child_of_name(const std::string & name) const { if(name == "authentication" || name == "configuration" || name == "pki") return true; return false; } Native::Crypto::Isakmp::Profile::Client::Authentication::Authentication() : list{YType::str, "list"} { yang_name = "authentication"; yang_parent_name = "client"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Profile::Client::Authentication::~Authentication() { } bool Native::Crypto::Isakmp::Profile::Client::Authentication::has_data() const { if (is_presence_container) return true; return list.is_set; } bool Native::Crypto::Isakmp::Profile::Client::Authentication::has_operation() const { return is_set(yfilter) || ydk::is_set(list.yfilter); } std::string Native::Crypto::Isakmp::Profile::Client::Authentication::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "authentication"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::Client::Authentication::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (list.is_set || is_set(list.yfilter)) leaf_name_data.push_back(list.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::Client::Authentication::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::Client::Authentication::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Profile::Client::Authentication::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "list") { list = value; list.value_namespace = name_space; list.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Profile::Client::Authentication::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "list") { list.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Profile::Client::Authentication::has_leaf_or_child_of_name(const std::string & name) const { if(name == "list") return true; return false; } Native::Crypto::Isakmp::Profile::Client::Configuration::Configuration() : address{YType::enumeration, "address"}, group{YType::str, "group"} { yang_name = "configuration"; yang_parent_name = "client"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Profile::Client::Configuration::~Configuration() { } bool Native::Crypto::Isakmp::Profile::Client::Configuration::has_data() const { if (is_presence_container) return true; return address.is_set || group.is_set; } bool Native::Crypto::Isakmp::Profile::Client::Configuration::has_operation() const { return is_set(yfilter) || ydk::is_set(address.yfilter) || ydk::is_set(group.yfilter); } std::string Native::Crypto::Isakmp::Profile::Client::Configuration::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "configuration"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::Client::Configuration::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (address.is_set || is_set(address.yfilter)) leaf_name_data.push_back(address.get_name_leafdata()); if (group.is_set || is_set(group.yfilter)) leaf_name_data.push_back(group.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::Client::Configuration::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::Client::Configuration::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void Native::Crypto::Isakmp::Profile::Client::Configuration::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "address") { address = value; address.value_namespace = name_space; address.value_namespace_prefix = name_space_prefix; } if(value_path == "group") { group = value; group.value_namespace = name_space; group.value_namespace_prefix = name_space_prefix; } } void Native::Crypto::Isakmp::Profile::Client::Configuration::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "address") { address.yfilter = yfilter; } if(value_path == "group") { group.yfilter = yfilter; } } bool Native::Crypto::Isakmp::Profile::Client::Configuration::has_leaf_or_child_of_name(const std::string & name) const { if(name == "address" || name == "group") return true; return false; } Native::Crypto::Isakmp::Profile::Client::Pki::Pki() : authorization(std::make_shared<Native::Crypto::Isakmp::Profile::Client::Pki::Authorization>()) { authorization->parent = this; yang_name = "pki"; yang_parent_name = "client"; is_top_level_class = false; has_list_ancestor = true; } Native::Crypto::Isakmp::Profile::Client::Pki::~Pki() { } bool Native::Crypto::Isakmp::Profile::Client::Pki::has_data() const { if (is_presence_container) return true; return (authorization != nullptr && authorization->has_data()); } bool Native::Crypto::Isakmp::Profile::Client::Pki::has_operation() const { return is_set(yfilter) || (authorization != nullptr && authorization->has_operation()); } std::string Native::Crypto::Isakmp::Profile::Client::Pki::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "pki"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > Native::Crypto::Isakmp::Profile::Client::Pki::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> Native::Crypto::Isakmp::Profile::Client::Pki::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "authorization") { if(authorization == nullptr) { authorization = std::make_shared<Native::Crypto::Isakmp::Profile::Client::Pki::Authorization>(); } return authorization; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> Native::Crypto::Isakmp::Profile::Client::Pki::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(authorization != nullptr) { _children["authorization"] = authorization; } return _children; } void Native::Crypto::Isakmp::Profile::Client::Pki::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void Native::Crypto::Isakmp::Profile::Client::Pki::set_filter(const std::string & value_path, YFilter yfilter) { } bool Native::Crypto::Isakmp::Profile::Client::Pki::has_leaf_or_child_of_name(const std::string & name) const { if(name == "authorization") return true; return false; } const Enum::YLeaf Native::Crypto::Key::Export::Ec::Pem::Url::File::bootflash__COLON__ {0, "bootflash:"}; const Enum::YLeaf Native::Crypto::Key::Export::Ec::Pem::Url::File::flash__COLON__ {1, "flash:"}; const Enum::YLeaf Native::Crypto::Key::Export::Ec::Pem::Url::File::ftp__COLON__ {2, "ftp:"}; const Enum::YLeaf Native::Crypto::Key::Export::Ec::Pem::Url::File::http__COLON__ {3, "http:"}; const Enum::YLeaf Native::Crypto::Key::Export::Ec::Pem::Url::File::https__COLON__ {4, "https:"}; const Enum::YLeaf Native::Crypto::Key::Export::Ec::Pem::Url::File::null__COLON__ {5, "null:"}; const Enum::YLeaf Native::Crypto::Key::Export::Ec::Pem::Url::File::nvram__COLON__ {6, "nvram:"}; const Enum::YLeaf Native::Crypto::Key::Export::Ec::Pem::Url::File::pram__COLON__ {7, "pram:"}; const Enum::YLeaf Native::Crypto::Key::Export::Ec::Pem::Url::File::rcp__COLON__ {8, "rcp:"}; const Enum::YLeaf Native::Crypto::Key::Export::Ec::Pem::Url::File::scp__COLON__ {9, "scp:"}; const Enum::YLeaf Native::Crypto::Key::Export::Ec::Pem::Url::File::system__COLON__ {10, "system:"}; const Enum::YLeaf Native::Crypto::Key::Export::Ec::Pem::Url::File::tftp__COLON__ {11, "tftp:"}; const Enum::YLeaf Native::Crypto::Key::Export::Ec::Pem::Url::File::tmpsys__COLON__ {12, "tmpsys:"}; const Enum::YLeaf Native::Crypto::Key::Export::Rsa::Pem::Url::File::bootflash__COLON__ {0, "bootflash:"}; const Enum::YLeaf Native::Crypto::Key::Export::Rsa::Pem::Url::File::flash__COLON__ {1, "flash:"}; const Enum::YLeaf Native::Crypto::Key::Export::Rsa::Pem::Url::File::ftp__COLON__ {2, "ftp:"}; const Enum::YLeaf Native::Crypto::Key::Export::Rsa::Pem::Url::File::http__COLON__ {3, "http:"}; const Enum::YLeaf Native::Crypto::Key::Export::Rsa::Pem::Url::File::https__COLON__ {4, "https:"}; const Enum::YLeaf Native::Crypto::Key::Export::Rsa::Pem::Url::File::null__COLON__ {5, "null:"}; const Enum::YLeaf Native::Crypto::Key::Export::Rsa::Pem::Url::File::nvram__COLON__ {6, "nvram:"}; const Enum::YLeaf Native::Crypto::Key::Export::Rsa::Pem::Url::File::pram__COLON__ {7, "pram:"}; const Enum::YLeaf Native::Crypto::Key::Export::Rsa::Pem::Url::File::rcp__COLON__ {8, "rcp:"}; const Enum::YLeaf Native::Crypto::Key::Export::Rsa::Pem::Url::File::scp__COLON__ {9, "scp:"}; const Enum::YLeaf Native::Crypto::Key::Export::Rsa::Pem::Url::File::system__COLON__ {10, "system:"}; const Enum::YLeaf Native::Crypto::Key::Export::Rsa::Pem::Url::File::tftp__COLON__ {11, "tftp:"}; const Enum::YLeaf Native::Crypto::Key::Export::Rsa::Pem::Url::File::tmpsys__COLON__ {12, "tmpsys:"}; const Enum::YLeaf Native::Crypto::Key::Generate::Ec::Keysize::Y_256 {0, "256"}; const Enum::YLeaf Native::Crypto::Key::Generate::Ec::Keysize::Y_384 {1, "384"}; const Enum::YLeaf Native::Crypto::Key::Import::Ec::Url::File::bootflash__COLON__ {0, "bootflash:"}; const Enum::YLeaf Native::Crypto::Key::Import::Ec::Url::File::cns__COLON__ {1, "cns:"}; const Enum::YLeaf Native::Crypto::Key::Import::Ec::Url::File::flash__COLON__ {2, "flash:"}; const Enum::YLeaf Native::Crypto::Key::Import::Ec::Url::File::ftp__COLON__ {3, "ftp:"}; const Enum::YLeaf Native::Crypto::Key::Import::Ec::Url::File::http__COLON__ {4, "http:"}; const Enum::YLeaf Native::Crypto::Key::Import::Ec::Url::File::https__COLON__ {5, "https:"}; const Enum::YLeaf Native::Crypto::Key::Import::Ec::Url::File::null__COLON__ {6, "null:"}; const Enum::YLeaf Native::Crypto::Key::Import::Ec::Url::File::nvram__COLON__ {7, "nvram:"}; const Enum::YLeaf Native::Crypto::Key::Import::Ec::Url::File::pram__COLON__ {8, "pram:"}; const Enum::YLeaf Native::Crypto::Key::Import::Ec::Url::File::rcp__COLON__ {9, "rcp:"}; const Enum::YLeaf Native::Crypto::Key::Import::Ec::Url::File::scp__COLON__ {10, "scp:"}; const Enum::YLeaf Native::Crypto::Key::Import::Ec::Url::File::system__COLON__ {11, "system:"}; const Enum::YLeaf Native::Crypto::Key::Import::Ec::Url::File::tar__COLON__ {12, "tar:"}; const Enum::YLeaf Native::Crypto::Key::Import::Ec::Url::File::tftp__COLON__ {13, "tftp:"}; const Enum::YLeaf Native::Crypto::Key::Import::Ec::Url::File::tmpsys__COLON__ {14, "tmpsys:"}; const Enum::YLeaf Native::Crypto::Key::Import::Rsa::Url::File::bootflash__COLON__ {0, "bootflash:"}; const Enum::YLeaf Native::Crypto::Key::Import::Rsa::Url::File::cns__COLON__ {1, "cns:"}; const Enum::YLeaf Native::Crypto::Key::Import::Rsa::Url::File::flash__COLON__ {2, "flash:"}; const Enum::YLeaf Native::Crypto::Key::Import::Rsa::Url::File::ftp__COLON__ {3, "ftp:"}; const Enum::YLeaf Native::Crypto::Key::Import::Rsa::Url::File::http__COLON__ {4, "http:"}; const Enum::YLeaf Native::Crypto::Key::Import::Rsa::Url::File::https__COLON__ {5, "https:"}; const Enum::YLeaf Native::Crypto::Key::Import::Rsa::Url::File::null__COLON__ {6, "null:"}; const Enum::YLeaf Native::Crypto::Key::Import::Rsa::Url::File::nvram__COLON__ {7, "nvram:"}; const Enum::YLeaf Native::Crypto::Key::Import::Rsa::Url::File::pram__COLON__ {8, "pram:"}; const Enum::YLeaf Native::Crypto::Key::Import::Rsa::Url::File::rcp__COLON__ {9, "rcp:"}; const Enum::YLeaf Native::Crypto::Key::Import::Rsa::Url::File::scp__COLON__ {10, "scp:"}; const Enum::YLeaf Native::Crypto::Key::Import::Rsa::Url::File::system__COLON__ {11, "system:"}; const Enum::YLeaf Native::Crypto::Key::Import::Rsa::Url::File::tar__COLON__ {12, "tar:"}; const Enum::YLeaf Native::Crypto::Key::Import::Rsa::Url::File::tftp__COLON__ {13, "tftp:"}; const Enum::YLeaf Native::Crypto::Key::Import::Rsa::Url::File::tmpsys__COLON__ {14, "tmpsys:"}; const Enum::YLeaf Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::Use::encryption {0, "encryption"}; const Enum::YLeaf Native::Crypto::Key::PubkeyChain::Rsa::AddressedKey::Use::signature {1, "signature"}; const Enum::YLeaf Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::Use::encryption {0, "encryption"}; const Enum::YLeaf Native::Crypto::Key::PubkeyChain::Rsa::NamedKey::Use::signature {1, "signature"}; const Enum::YLeaf Native::Crypto::Key::PubkeyChain::Rsa::Default::AddressedKey::Use::encryption {0, "encryption"}; const Enum::YLeaf Native::Crypto::Key::PubkeyChain::Rsa::Default::AddressedKey::Use::signature {1, "signature"}; const Enum::YLeaf Native::Crypto::Key::PubkeyChain::Rsa::Default::NamedKey::Use::encryption {0, "encryption"}; const Enum::YLeaf Native::Crypto::Key::PubkeyChain::Rsa::Default::NamedKey::Use::signature {1, "signature"}; const Enum::YLeaf Native::Crypto::Keyring::Default::PreSharedKey::Address::Ipv4::Encryption::Y_0 {0, "0"}; const Enum::YLeaf Native::Crypto::Keyring::Default::PreSharedKey::Address::Ipv4::Encryption::Y_6 {1, "6"}; const Enum::YLeaf Native::Crypto::Keyring::Default::PreSharedKey::Address::Ipv6::Encryption::Y_0 {0, "0"}; const Enum::YLeaf Native::Crypto::Keyring::Default::PreSharedKey::Address::Ipv6::Encryption::Y_6 {1, "6"}; const Enum::YLeaf Native::Crypto::Keyring::Default::PreSharedKey::Hostname::Encryption::Y_0 {0, "0"}; const Enum::YLeaf Native::Crypto::Keyring::Default::PreSharedKey::Hostname::Encryption::Y_6 {1, "6"}; const Enum::YLeaf Native::Crypto::Keyring::Default::RsaPubkey::Addr::Way::encryption {0, "encryption"}; const Enum::YLeaf Native::Crypto::Keyring::Default::RsaPubkey::Addr::Way::signature {1, "signature"}; const Enum::YLeaf Native::Crypto::Keyring::Default::RsaPubkey::Hostname::Way::encryption {0, "encryption"}; const Enum::YLeaf Native::Crypto::Keyring::Default::RsaPubkey::Hostname::Way::signature {1, "signature"}; const Enum::YLeaf Native::Crypto::Keyring::PreSharedKey::Address::Ipv4::Encryption::Y_0 {0, "0"}; const Enum::YLeaf Native::Crypto::Keyring::PreSharedKey::Address::Ipv4::Encryption::Y_6 {1, "6"}; const Enum::YLeaf Native::Crypto::Keyring::PreSharedKey::Address::Ipv6::Encryption::Y_0 {0, "0"}; const Enum::YLeaf Native::Crypto::Keyring::PreSharedKey::Address::Ipv6::Encryption::Y_6 {1, "6"}; const Enum::YLeaf Native::Crypto::Keyring::PreSharedKey::Hostname::Encryption::Y_0 {0, "0"}; const Enum::YLeaf Native::Crypto::Keyring::PreSharedKey::Hostname::Encryption::Y_6 {1, "6"}; const Enum::YLeaf Native::Crypto::Keyring::RsaPubkey::Addr::Way::encryption {0, "encryption"}; const Enum::YLeaf Native::Crypto::Keyring::RsaPubkey::Addr::Way::signature {1, "signature"}; const Enum::YLeaf Native::Crypto::Keyring::RsaPubkey::Hostname::Way::encryption {0, "encryption"}; const Enum::YLeaf Native::Crypto::Keyring::RsaPubkey::Hostname::Way::signature {1, "signature"}; const Enum::YLeaf Native::Crypto::Isakmp::AggressiveMode::disable {0, "disable"}; const Enum::YLeaf Native::Crypto::Isakmp::Identity::address {0, "address"}; const Enum::YLeaf Native::Crypto::Isakmp::Identity::dn {1, "dn"}; const Enum::YLeaf Native::Crypto::Isakmp::Identity::hostname {2, "hostname"}; const Enum::YLeaf Native::Crypto::Isakmp::Client::Configuration::Group::Configuration_::Url::bootflash__COLON__ {0, "bootflash:"}; const Enum::YLeaf Native::Crypto::Isakmp::Client::Configuration::Group::Configuration_::Url::cns__COLON__ {1, "cns:"}; const Enum::YLeaf Native::Crypto::Isakmp::Client::Configuration::Group::Configuration_::Url::flash__COLON__ {2, "flash:"}; const Enum::YLeaf Native::Crypto::Isakmp::Client::Configuration::Group::Configuration_::Url::ftp__COLON__ {3, "ftp:"}; const Enum::YLeaf Native::Crypto::Isakmp::Client::Configuration::Group::Configuration_::Url::http__COLON__ {4, "http:"}; const Enum::YLeaf Native::Crypto::Isakmp::Client::Configuration::Group::Configuration_::Url::https__COLON__ {5, "https:"}; const Enum::YLeaf Native::Crypto::Isakmp::Client::Configuration::Group::Configuration_::Url::null__COLON__ {6, "null:"}; const Enum::YLeaf Native::Crypto::Isakmp::Client::Configuration::Group::Configuration_::Url::nvram__COLON__ {7, "nvram:"}; const Enum::YLeaf Native::Crypto::Isakmp::Client::Configuration::Group::Configuration_::Url::pram__COLON__ {8, "pram:"}; const Enum::YLeaf Native::Crypto::Isakmp::Client::Configuration::Group::Configuration_::Url::rcp__COLON__ {9, "rcp:"}; const Enum::YLeaf Native::Crypto::Isakmp::Client::Configuration::Group::Configuration_::Url::scp__COLON__ {10, "scp:"}; const Enum::YLeaf Native::Crypto::Isakmp::Client::Configuration::Group::Configuration_::Url::system__COLON__ {11, "system:"}; const Enum::YLeaf Native::Crypto::Isakmp::Client::Configuration::Group::Configuration_::Url::tar__COLON__ {12, "tar:"}; const Enum::YLeaf Native::Crypto::Isakmp::Client::Configuration::Group::Configuration_::Url::tftp__COLON__ {13, "tftp:"}; const Enum::YLeaf Native::Crypto::Isakmp::Client::Configuration::Group::Configuration_::Url::tmpsys__COLON__ {14, "tmpsys:"}; const Enum::YLeaf Native::Crypto::Isakmp::Client::Configuration::Group::Key::Encryption::Y_0 {0, "0"}; const Enum::YLeaf Native::Crypto::Isakmp::Client::Configuration::Group::Key::Encryption::Y_6 {1, "6"}; const Enum::YLeaf Native::Crypto::Isakmp::Client::Firewall::Optional::cisco_integrated_client_firewall {0, "cisco-integrated-client-firewall"}; const Enum::YLeaf Native::Crypto::Isakmp::Client::Firewall::Optional::cisco_security_agent {1, "cisco-security-agent"}; const Enum::YLeaf Native::Crypto::Isakmp::Client::Firewall::Optional::zonelabs_zonealarm {2, "zonelabs-zonealarm"}; const Enum::YLeaf Native::Crypto::Isakmp::Client::Firewall::Optional::zonelabs_zonealarmpro {3, "zonelabs-zonealarmpro"}; const Enum::YLeaf Native::Crypto::Isakmp::Client::Firewall::Required::cisco_integrated_client_firewall {0, "cisco-integrated-client-firewall"}; const Enum::YLeaf Native::Crypto::Isakmp::Client::Firewall::Required::cisco_security_agent {1, "cisco-security-agent"}; const Enum::YLeaf Native::Crypto::Isakmp::Client::Firewall::Required::zonelabs_zonealarm {2, "zonelabs-zonealarm"}; const Enum::YLeaf Native::Crypto::Isakmp::Client::Firewall::Required::zonelabs_zonealarmpro {3, "zonelabs-zonealarmpro"}; const Enum::YLeaf Native::Crypto::Isakmp::Client::Firewall::Policy::CentralPolicyPush::AccessList::Direction::in {0, "in"}; const Enum::YLeaf Native::Crypto::Isakmp::Client::Firewall::Policy::CentralPolicyPush::AccessList::Direction::out {1, "out"}; const Enum::YLeaf Native::Crypto::Isakmp::Keepalive::Send::on_demand {0, "on-demand"}; const Enum::YLeaf Native::Crypto::Isakmp::Keepalive::Send::periodic {1, "periodic"}; const Enum::YLeaf Native::Crypto::Isakmp::Key::KeyAddress::Encryption::Y_0 {0, "0"}; const Enum::YLeaf Native::Crypto::Isakmp::Key::KeyAddress::Encryption::Y_6 {1, "6"}; const Enum::YLeaf Native::Crypto::Isakmp::Key::KeyHost::Encryption::Y_0 {0, "0"}; const Enum::YLeaf Native::Crypto::Isakmp::Key::KeyHost::Encryption::Y_6 {1, "6"}; const Enum::YLeaf Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::Password::Encryption::Y_0 {0, "0"}; const Enum::YLeaf Native::Crypto::Isakmp::Peer::Ipv4Addr::Address::Set::AggressiveMode::Password::Encryption::Y_6 {1, "6"}; const Enum::YLeaf Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::Password::Encryption::Y_0 {0, "0"}; const Enum::YLeaf Native::Crypto::Isakmp::Peer::Ipv6Addr::Address::Set::AggressiveMode::Password::Encryption::Y_6 {1, "6"}; const Enum::YLeaf Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::Password::Encryption::Y_0 {0, "0"}; const Enum::YLeaf Native::Crypto::Isakmp::Peer::Hostname::Set::AggressiveMode::Password::Encryption::Y_6 {1, "6"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Authentication::pre_share {0, "pre-share"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Authentication::rsa_encr {1, "rsa-encr"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Authentication::rsa_sig {2, "rsa-sig"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Group::Y_1 {0, "1"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Group::Y_14 {1, "14"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Group::Y_15 {2, "15"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Group::Y_16 {3, "16"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Group::Y_19 {4, "19"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Group::Y_2 {5, "2"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Group::Y_20 {6, "20"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Group::Y_21 {7, "21"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Group::Y_24 {8, "24"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Group::Y_5 {9, "5"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Hash::md5 {0, "md5"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Hash::sha {1, "sha"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Hash::sha256 {2, "sha256"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Hash::sha384 {3, "sha384"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Hash::sha512 {4, "sha512"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Default::Authentication::pre_share {0, "pre-share"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Default::Authentication::rsa_encr {1, "rsa-encr"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Default::Authentication::rsa_sig {2, "rsa-sig"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Default::Group::Y_1 {0, "1"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Default::Group::Y_14 {1, "14"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Default::Group::Y_15 {2, "15"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Default::Group::Y_16 {3, "16"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Default::Group::Y_19 {4, "19"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Default::Group::Y_2 {5, "2"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Default::Group::Y_20 {6, "20"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Default::Group::Y_21 {7, "21"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Default::Group::Y_24 {8, "24"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Default::Group::Y_5 {9, "5"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Default::Hash::md5 {0, "md5"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Default::Hash::sha {1, "sha"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Default::Hash::sha256 {2, "sha256"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Default::Hash::sha384 {3, "sha384"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Default::Hash::sha512 {4, "sha512"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Default::Encryption::Aes::Key::Y_128 {0, "128"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Default::Encryption::Aes::Key::Y_192 {1, "192"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Default::Encryption::Aes::Key::Y_256 {2, "256"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Encryption::Aes::Key::Y_128 {0, "128"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Encryption::Aes::Key::Y_192 {1, "192"}; const Enum::YLeaf Native::Crypto::Isakmp::Policy::Encryption::Aes::Key::Y_256 {2, "256"}; const Enum::YLeaf Native::Crypto::Isakmp::Profile::Keyring::default_ {0, "default"}; const Enum::YLeaf Native::Crypto::Isakmp::Profile::Default::Keyring::default_ {0, "default"}; const Enum::YLeaf Native::Crypto::Isakmp::Profile::Default::Client::Configuration::Address::initiate {0, "initiate"}; const Enum::YLeaf Native::Crypto::Isakmp::Profile::Default::Client::Configuration::Address::respond {1, "respond"}; const Enum::YLeaf Native::Crypto::Isakmp::Profile::Client::Configuration::Address::initiate {0, "initiate"}; const Enum::YLeaf Native::Crypto::Isakmp::Profile::Client::Configuration::Address::respond {1, "respond"}; } }
d21323a773b3beaf8e4752c4db87f5b1dd2f1ecb
1621bd8219d28d13faa8324c9c66e963e1069aca
/ScreenCapture.h
e3df7ba8a60dfab421ce469b1252537d8b34f10a
[]
no_license
paul415236/x11
44998c68597198aeb508b1e36df89949889d6170
7280f12a79c97f4f5218e3957c0661be3deeb024
refs/heads/master
2021-01-20T23:36:26.196623
2014-01-26T09:20:48
2014-01-26T09:20:48
null
0
0
null
null
null
null
UTF-8
C++
false
false
999
h
ScreenCapture.h
#ifndef _SCREENCAPTURE_H_ #define _SCREENCAPTURE_H_ const float X_OPEN_INTERVALTIME = 0.1; const int IMAGE_BUFFER_SIZE = 1024 * 800; const int GRAPHIC_SIZE = 40 * 1024; typedef struct _image_item { unsigned char *pOutBuf; unsigned long lOutSize; int count ; int mod; int frameIndex; int endflag; }IMAGE_ITEM, *PIMAGE_ITEM; typedef struct _screen_image { long width; long height; long bytesPerLine; char *pData; }SCREEN_IMAGE, *PSCREEN_IMAGE; class ScreenCapture { public: ScreenCapture(); ~ScreenCapture(); public: bool create(const char *fbPath); void destroy(); bool capture(SCREEN_IMAGE & img); public: bool parse(char* pXwdBuf, char** pImageData, long& width, long& height, long& bytePerLine); void swapLong(char * bp) const; private: char *m_pBuffer; char *m_pCapBuf; int m_iFBhd; long m_lFBSize; //just for test public: long getFBSize() const { return m_lFBSize; } }; #endif /* _SCREENCAPTURE_H_ */
1cc500d5143c38d2d00838ee08107743f6669874
75155538100c37e12b501448dd587ad48466f65c
/src/Entity.h
267dff10ce7d218afff374ef29cd24002f9a6e9c
[]
no_license
DaniBarca/PlaneGame
3bb0986f3050a0cd9689eae5947955c1655ab0d1
ffaa71833b93dbea5c66a71e29851dbf49708e3d
refs/heads/master
2020-04-09T22:59:52.818591
2013-06-28T09:49:21
2013-06-28T09:49:21
10,364,031
0
0
null
null
null
null
UTF-8
C++
false
false
423
h
Entity.h
/* * Entity */ #ifndef ENTITY_H #define ENTITY_H #include "framework.h" #include <string> class Entity{ public: static int last_id; Entity(Vector3 position = Vector3(0,0,0)); Matrix44 getMatrix(){return matrix_;} bool Entity::isNearerThan(Entity* ent, int dist); float distance(Entity* b); virtual void reset(); std::string name_; protected: Matrix44 matrix_; Matrix44 initial_matrix; int id; }; #endif
557c60f3fa72cbc8489ee7576c857eb711c11a09
e94f1d263665b288d517974960677ea36938f157
/Day17/spinlock2.cpp
762d558880d983dd076e4cc1d2f376ed288560a6
[]
no_license
yuvii28/Advent17
fc4e2143a17b3f7d0a34b3a56ec81b30916d4330
ef0361cd2ab442891de3f88102af013f7dc4eb59
refs/heads/master
2021-08-31T11:29:41.595315
2017-12-21T06:34:59
2017-12-21T06:34:59
113,120,790
0
0
null
null
null
null
UTF-8
C++
false
false
517
cpp
spinlock2.cpp
#include <iostream> #include <fstream> #include <sstream> #include <string> #include <vector> #include <algorithm> #include <queue> int main(int argc, char* argv[]){ int currPos = 0; int supposedSize = 1; int steps = 337; int result = 0; for (int i = 1; i < 50000000; i++){ //Move forward n % size steps int move = steps % supposedSize; currPos = (currPos + move) % supposedSize; if (currPos == 0){ result = i; } supposedSize++; currPos++; } std::cout << result << std::endl; return 0; }
89ba616c8d64b4ce3af30b700e6434ec0142fcd2
2f72d621e6ec03b9ea243a96e8dd947a952da087
/include/Source.h
0300a77135a6ed1264c4cf0de54fb72473ce43f9
[]
no_license
gspu/lol4fg
752358c3c3431026ed025e8cb8777e4807eed7a0
12a08f3ef1126ce679ea05293fe35525065ab253
refs/heads/master
2023-04-30T05:32:03.826238
2011-07-23T23:35:14
2011-07-23T23:35:14
364,193,504
0
0
null
null
null
null
ISO-8859-1
C++
false
false
8,979
h
Source.h
#ifndef __mSoundSrc #define __mSoundSrc #include "alc.h" #include "al.h" #include "Ogre.h" #include "Sound.h" #include "Buffer.h" namespace SimpleSound { class Source { friend class SoundManager; public: enum SourceState { Null = 0, Initial = 1, Playing = 2, Paused = 3, Stopped = 4 }; inline void setPosition(Ogre::Vector3 pos) { alSource3f(alSource, AL_POSITION,pos.x,pos.y,pos.z); } inline Ogre::Vector3 getPosition() { Ogre::Vector3 pos; alGetSource3f(alSource, AL_POSITION,&pos.x,&pos.y,&pos.z); return pos; } inline void setOrientation(Ogre::Quaternion ornt) { Ogre::Vector3 fore = ornt*Ogre::Vector3::NEGATIVE_UNIT_Z; /*Ogre::Vector3 up = ornt*Ogre::Vector3::UNIT_Y; float vec[6]; vec[0] = fore.x; vec[1] = fore.y; vec[2] = fore.z; vec[3] = up.x; vec[4] = up.y; vec[5] = up.z;*/ alSource3f(alSource, AL_DIRECTION,fore.x,fore.y,fore.z); } inline Ogre::Quaternion getOrientation() { Ogre::Vector3 fore;/* = ornt*Ogre::Vector3::NEGATIVE_UNIT_Z;*/ /*Ogre::Vector3 up = ornt*Ogre::Vector3::UNIT_Y; float vec[6]; vec[0] = fore.x; vec[1] = fore.y; vec[2] = fore.z; vec[3] = up.x; vec[4] = up.y; vec[5] = up.z;*/ alGetSource3f(alSource, AL_DIRECTION,&fore.x,&fore.y,&fore.z); return Ogre::Vector3::NEGATIVE_UNIT_Z.getRotationTo(fore); } inline void setVelocity(Ogre::Vector3 vel) { alSource3f(alSource, AL_VELOCITY,vel.x,vel.y,vel.z); } inline Ogre::Vector3 getVelocity() { Ogre::Vector3 vel; alGetSource3f(alSource, AL_VELOCITY,&vel.x,&vel.y,&vel.z); return vel; } void setBuffer(Buffer *buffer); inline Buffer *getBuffer() { return mBuffer; } /* Play, replay, or resume a Source */ inline void play() { if(!mBuffer) return; if(!alSource) { if(bak && bak->relToListener) retrieveALSource(2); else retrieveALSource(1); } alGetError(); alSourcePlay( alSource ); if(alGetError()) { Ogre::LogManager::getSingletonPtr()->logMessage("play error"); } } /* Pause a Source */ inline void pause() { if(!mBuffer) return; alGetError(); alSourcePause( alSource ); } /* Stop a Source */ inline void stop() { if(!mBuffer) return; alGetError(); alSourceStop( alSource ); } /* Rewind a Source (set playback postiton to beginning) */ inline void rewind() { if(!mBuffer) return; alSourceRewind( alSource ); } inline bool isPlaying() { return getSourceState() == Playing; } inline bool isStopped() { return getSourceState() == Stopped; } inline bool isPaused() { return getSourceState() == Paused; } inline SourceState getSourceState() { ALint temp; alGetSourcei( alSource, AL_SOURCE_STATE, &temp ); switch(temp) { case AL_INITIAL: return Initial; case AL_PLAYING: return Playing; case AL_PAUSED: return Paused; case AL_STOPPED: return Stopped; } return Null; } inline void setGain(Ogre::Real gain) { alGetError(); alSourcef(alSource,AL_GAIN,gain); if(alGetError()) { Ogre::LogManager::getSingletonPtr()->logMessage("could not set gain. WTF?"); } } inline void setMinGain(Ogre::Real gain) { alSourcef(alSource,AL_MIN_GAIN,gain); } inline void setMaxGain(Ogre::Real gain) { alSourcef(alSource,AL_MAX_GAIN,gain); } inline void setRelativeToListener(bool set) { alSourcei(alSource,AL_SOURCE_RELATIVE,set?AL_TRUE:AL_FALSE); } inline void setReferenceDistance(Ogre::Real dist) { alSourcef(alSource,AL_REFERENCE_DISTANCE,dist); } inline void setMaxDistance(Ogre::Real dist) { alSourcef(alSource,AL_MAX_DISTANCE,dist); } inline void setRolloffFactor(Ogre::Real factor) { alSourcef(alSource,AL_ROLLOFF_FACTOR,factor); } inline void setConeInnerAngle(Ogre::Real angle) { alSourcef(alSource,AL_CONE_INNER_ANGLE,angle); } inline void setConeOuterAngle(Ogre::Real angle) { alSourcef(alSource,AL_CONE_OUTER_ANGLE,angle); } inline void setConeOuterGain(Ogre::Real gain) { alSourcef(alSource,AL_CONE_OUTER_GAIN,gain); } inline void setPitch(Ogre::Real pitch) { alSourcef(alSource,AL_PITCH,pitch); } inline void setLoop(bool set) { alSourcei(alSource,AL_LOOPING,set?AL_TRUE:AL_FALSE); } /*THis is called Millisec. Offset in the OpenAL documentation, but the variable is called SEC_OFFSET, so no idea what exactly this is*/ inline void setMsecOffset(Ogre::Real offset) { alSourcef(alSource,AL_SEC_OFFSET,offset); } inline void setByteOffset(Ogre::Real offset) { alSourcef(alSource,AL_BYTE_OFFSET,offset); } inline void setSampleOffset(Ogre::Real offset) { alSourcef(alSource,AL_SAMPLE_OFFSET,offset); } inline Ogre::Real getGain() { Ogre::Real gain = 0; alGetSourcef(alSource,AL_GAIN,&gain); return gain; } inline Ogre::Real getMinGain() { Ogre::Real gain = 0; alGetSourcef(alSource,AL_MIN_GAIN,&gain); return gain; } inline Ogre::Real getMaxGain() { Ogre::Real gain = 0; alGetSourcef(alSource,AL_MAX_GAIN,&gain); return gain; } inline bool getRelativeToListener() { int set = 0; alGetSourcei(alSource,AL_SOURCE_RELATIVE,&set); return set==AL_TRUE?true:false; } inline Ogre::Real getReferenceDistance() { Ogre::Real dist = 0; alGetSourcef(alSource,AL_REFERENCE_DISTANCE,&dist); return dist; } inline Ogre::Real getMaxDistance() { Ogre::Real dist = 0; alGetSourcef(alSource,AL_MAX_DISTANCE,&dist); return dist; } inline Ogre::Real getRolloffFactor() { Ogre::Real factor = 0; alGetSourcef(alSource,AL_ROLLOFF_FACTOR,&factor); return factor; } inline Ogre::Real getConeInnerAngle() { Ogre::Real angle = 0; alGetSourcef(alSource,AL_CONE_INNER_ANGLE,&angle); return angle; } inline Ogre::Real getConeOuterAngle() { Ogre::Real angle = 0; alGetSourcef(alSource,AL_CONE_OUTER_ANGLE,&angle); return angle; } inline Ogre::Real getConeOuterGain() { Ogre::Real gain = 0; alGetSourcef(alSource,AL_CONE_OUTER_GAIN,&gain); return gain; } inline Ogre::Real getPitch() { Ogre::Real pitch = 0; alGetSourcef(alSource,AL_PITCH,&pitch); return pitch; } inline bool getLoop() { int set = 0; alGetSourcei(alSource,AL_LOOPING,&set); return set==AL_TRUE?true:false; } inline Ogre::Real getMsecOffset() { Ogre::Real offset = 0; alGetSourcef(alSource,AL_SEC_OFFSET,&offset); return offset; } inline Ogre::Real getByteOffset() { Ogre::Real offset = 0; alGetSourcef(alSource,AL_BYTE_OFFSET,&offset); return offset; } inline Ogre::Real getSampleOffset() { Ogre::Real offset = 0; alGetSourcef(alSource,AL_SAMPLE_OFFSET,&offset); return offset; } //sets a custom "type" for this source //can be used to selectively set gain //via SoundManager::setTypeGain inline void setType(int set) { type = set; } inline int getType() { return type; } //versucht, sich eine neue AL-Source zu holen, falls die alte fehlt void retrieveALSource(int priority=0); /* * Attached Buffer AL_BUFFER ALint * State (Query only) AL_SOURCE_STATE ALint * Buffers Queued (Query only) AL_BUFFERS_QUEUED ALint * Buffers Processed (Query only) AL_BUFFERS_PROCESSED ALint */ private: struct SourceBackup { //diese Werte sind Backup, für den fall das die ALSource gestohlen wird Ogre::Vector3 mPos; Ogre::Vector3 mVel; Ogre::Quaternion mOrient; Ogre::Real mGain; Ogre::Real mMinGain; Ogre::Real mMaxGain; bool relToListener; Ogre::Real coneInnerAngle; Ogre::Real coneOuterAngle; Ogre::Real coneOuterGain; Ogre::Real pitch; bool loop; }; SourceBackup *bak; Source(ALuint src); ~Source(); //klaut die source, sichert aber vorher ihre stats ALuint stealALSource(); void setALSource(ALuint src); ALuint alSource; Buffer *mBuffer; int type; //this is for SoundManager::pauseAllSounds //if this is set to true, then resumeAllSounds will make this sound play bool pausedBySoundMgr; }; } #endif
901dac3db709bf6190c5712452cc932f995f99d3
174549921373b8a390daf1c9ea10063782102186
/SparkleZEngineRedux/Debug/include/Material.cpp
27a8afc7b3ab255a951843ba9ef047e867667f9a
[]
no_license
NathanCoultas/Sparklez
2ece85bfc4bfd6fa0f575307fab0b5e0fe7327ed
983ab44760a73c8cf3263a1039682d104f9df497
refs/heads/master
2020-03-21T15:07:50.207043
2018-07-15T03:06:01
2018-07-15T03:06:01
138,696,049
0
0
null
null
null
null
UTF-8
C++
false
false
1,298
cpp
Material.cpp
#include "Material.h" #include "sdl\include\SDL.h" #include "glm\gtc\type_ptr.hpp" #include "glm\gtc\matrix_transform.hpp" #include "Console.h" #include "GraphicsCache.h" #include <string> #include <iostream> #include <fstream> namespace sparklezEngine { Material::Material() { m_texture1 = 0; } void Material::SetShader(std::weak_ptr<Shader> _shader) { m_Shader = _shader; } void Material::SetEmissiveColour(glm::vec3 _input) { m_emissiveColour = _input; } void Material::SetDiffuseColour(glm::vec3 _input) { m_diffuseColour = _input; } void Material::SetSpecularColour(glm::vec3 _input) { m_specularColour = _input; } void Material::SetLightPosition(glm::vec3 _input) { m_lightPosition = _input; } void Material::SetLightItentsity(glm::vec3 _input) { m_LightIntent = _input; } bool Material::SetTexture(std::string _filename) { m_texture1 = GraphicsCache::LoadTexture(_filename); return m_texture1 > 0; } bool Material::SetSpecTexture(std::string _filename) { m_texture2 = GraphicsCache::LoadTexture(_filename); return m_texture2 > 1; } bool Material::SetIluTexture(std::string _filename) { m_texture3 = GraphicsCache::LoadTexture(_filename); return m_texture3 > 2; } }
d2568ddf03f1509a56cea576c1bc968ab26aa58c
f05a10a94b849b82e1d1c7d8a088fcb6945c8286
/TestProject/Src/Core/Synchronization/CPP11Thread.cpp
23bdbae9f4bfadceed63e902fa64aa3d730e2eca
[]
no_license
fatmingwang/TestProject
162be59b7bb96db1fb3b77c1a2cf823b43b3d7f5
338aa402492f523e1d54883070195867333e6e42
refs/heads/master
2020-06-03T16:53:29.432685
2019-06-16T16:55:10
2019-06-16T16:55:10
191,656,664
0
0
null
null
null
null
UTF-8
C++
false
false
1,999
cpp
CPP11Thread.cpp
#include "../stdafx.h" #include "CPP11Thread.h" #include "../GameplayUT/GameApp.h" namespace FATMING_CORE { cPP11MutexHolderDebug::cPP11MutexHolderDebug(std::mutex& e_mutex) :m_Mutex(e_mutex) { m_Mutex.lock(); } cPP11MutexHolderDebug::cPP11MutexHolderDebug(std::mutex& e_mutex, const wchar_t*e_strDebugInfo) :m_Mutex(e_mutex) { m_Mutex.lock(); if (e_strDebugInfo) { l_strDebugInfo = e_strDebugInfo; //OutputDebugString(e_strDebugInfo); //OutputDebugString(L" in\n"); } } cPP11MutexHolderDebug::~cPP11MutexHolderDebug() { m_Mutex.unlock(); if (l_strDebugInfo.length()) { //OutputDebugString(l_strDebugInfo.c_str()); //OutputDebugString(L" out\n"); } } cCPP11Thread::cCPP11Thread() { m_ThreadWorkingFunction = nullptr; m_bThreadWorking = false; m_bLeaveThread = false; //https://stackoverflow.com/questions/10673585/start-thread-with-member-function //call with std::function //std::thread WriteFileThread(&cWriteFileWithThreadManager::WriteFileThread,this); //call with lambda //std::thread WriteFileThread([this]() //{ //}); //call with member function to get thread //std::thread WriteFileThread = Spawn(); //WriteFileThread.detach(); } cCPP11Thread::~cCPP11Thread() { m_bLeaveThread = true; while (m_bThreadWorking) { } } void cCPP11Thread::ThreadDetach(f_ThreadWorkingFunction e_WorkingFunction) { m_bLeaveThread = false; m_ThreadWorkingFunction = e_WorkingFunction; std::thread l_Thread = std::thread([=] {cCPP11Thread::WorkingThread(); }); l_Thread.detach(); } void cCPP11Thread::CloseThreadAndWaitUntilFinish() { m_bLeaveThread = true; while (m_bThreadWorking) { Sleep(10); } } void cCPP11Thread::WorkingThread() { UT::sTimeAndFPS l_TimeAndFPS; l_TimeAndFPS.Update(); m_bThreadWorking = true; while (!m_bLeaveThread) { l_TimeAndFPS.Update(); if (m_ThreadWorkingFunction) m_ThreadWorkingFunction(l_TimeAndFPS.fElpaseTime); } m_bThreadWorking = false; } }
80b02dd7db239988bb287e4389bf59ea6a9ba378
23017336d25e6ec49c4a51f11c1b3a3aa10acf22
/csc3750/prog2/Pixel.cpp
9ee92d2fabb179be588a7780cf0bbb6ba7759a28
[]
no_license
tjshaffer21/School
5e7681c96e0c10966fc7362931412c4244507911
4aa5fc3a8bbbbb8d46d045244e8a7f84e71c768f
refs/heads/master
2020-05-27T19:05:06.422314
2011-05-17T19:55:40
2011-05-17T19:55:40
1,681,224
1
1
null
2017-07-29T13:35:54
2011-04-29T15:36:55
C++
UTF-8
C++
false
false
1,013
cpp
Pixel.cpp
#include "GL/glut.h" #include "Pixel.h" Pixel::Pixel(int width, int height) { xWindow = width; yWindow = height; } Pixel::~Pixel(){} void Pixel::setWidth(int width) { xWindow = width; } void Pixel::setHeight(int height) { yWindow = height; } int Pixel::getWidth() { return xWindow; } int Pixel::getHeight() { return yWindow; } void Pixel::drawPixel(int xPixel, int yPixel, Color color) { double xCanonical; double yCanonical; //convert from screen coordinates to projected world coordinates and plot one pixel //the calculation below is the "inverse" transform from screen coords to world coords that OpenGL wants xCanonical = (xPixel*2.0)/xWindow + (-1.0*(xWindow - 1))/xWindow; yCanonical = (-1.0*yPixel*2.0)/yWindow + (1.0*(yWindow - 1))/yWindow; color.setColor(); //makes an opengl call for me //plot a point glBegin(GL_POINTS); glVertex2f((float) xCanonical, (float) yCanonical); glEnd(); }
5acdbaa5f8b9ca0ecdc2b1a9d51cd74b8f7bfe02
039e198081ee8f84fee8b854e0850c3f5faa315c
/single-number.cpp
a06f320b06485ee108ecf0bdee7cb4b983ac7147
[ "MIT" ]
permissive
himeshnag/Ds-Algo-Hacktoberfest
2f11e31768f70296154ec19e5d11d7dfe4472c75
812cae461dcec72f54504c31b7b184916b31733b
refs/heads/master
2022-12-30T11:12:06.924382
2020-10-19T19:18:07
2020-10-19T19:18:07
305,477,186
0
0
null
2020-10-19T19:19:00
2020-10-19T18:25:47
Java
UTF-8
C++
false
false
618
cpp
single-number.cpp
/* Code by Urjita Sharma Given a non-empty array of integers, every element appears twice except for one. Find that single one. */ #include <iostream> #include <bits/stdc++.h> #include <vector> using namespace std; int singleNumber(vector<int>& nums) { int x=0; for(int i=0;i<nums.size();i++){ x=x^nums[i]; } return x; } int main() { cout<<"Enter length of array "<<endl; int n; cin>>n; vector<int> arr(n,0); cout<<"Enter numbers in array "<<endl; for(int i=0;i<n;i++){ int x; cin>>x; arr[i]=x; } cout<<"Single element is - "<<singleNumber(arr)<<endl; }
ef0d598b5887837246f3a836bfb6a45b80714848
886d6a119ffa38d59c8ad4ec719ecfec90ccb338
/ExampleApplication.cpp
1f02a890aa7cecf1c5b26e147b9a1ee4a6d1f2b3
[]
no_license
gragonvlad/glsandbox
a40dbf983835cb56ce149b839d061b979bde0cf5
8cfe5c11dcadc68d94d4c90a6f934e9fec4281e5
refs/heads/master
2021-01-01T20:32:11.638287
2012-09-24T00:26:21
2012-09-24T00:26:21
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,094
cpp
ExampleApplication.cpp
#ifndef GLEW_STATIC #define GLEW_STATIC #endif #include <gl/glew.h> #include <gl/gl.h> #include <cassert> #include "VertexBuffer.h" #include "ShaderManager.h" #include "Math3D.h" #include "Frustum.h" #include "TransformPipeline.h" #include "ExampleApplication.h" #include "TGAFile.h" #include "Texture2D.h" #include "CubeMapTexture.h" GLfloat floorVertices[] = { -20.0f, 0.0f, -20.0f, -20.0f, 0.0f, 20.0f, 20.0f, 0.0f, 20.0f, 20.0f, 0.0f, -20.0f }; GLfloat floorNormals[] = { 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f }; GLfloat floorTexCoords[] = { 0.0f, 0.0f, 0.0f, 20.0f, 20.0f, 20.0f, 20.0f, 0.0f }; GLfloat boxTexCoords[] = { //front 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f }; GLfloat boxVertices[] = { // front -0.5f, 1.0f, 0.0f, -0.5f, 0.0f, 0.0f, 0.5f, 0.0f, 0.0f, 0.5f, 0.0f, 0.0f, 0.5f, 1.0f, 0.0f, -0.5f, 1.0f, 0.0f, //back -0.5f, 1.0f, -1.0f, -0.5f, 0.0f, -1.0f, 0.5f, 0.0f, -1.0f, 0.5f, 0.0f, -1.0f, 0.5f, 1.0f, -1.0f, -0.5f, 1.0f, -1.0f, // left -0.5f, 1.0f, -1.0f, -0.5f, 0.0f, -1.0f, -0.5f, 0.0f, 0.0f, -0.5f, 0.0f, 0.0f, -0.5f, 1.0f, 0.0f, -0.5f, 1.0f, -1.0f, // right 0.5f, 1.0f, -1.0f, 0.5f, 0.0f, -1.0f, 0.5f, 0.0f, 0.0f, 0.5f, 0.0f, 0.0f, 0.5f, 1.0f, 0.0f, 0.5f, 1.0f, -1.0f, // top -0.5f, 1.0f, -1.0f, -0.5f, 1.0f, 0.0f, 0.5f, 1.0f, 0.0f, 0.5f, 1.0f, 0.0f, 0.5f, 1.0f, -1.0f, -0.5f, 1.0f, -1.0f, // bottom -0.5f, 0.0f, -1.0f, -0.5f, 0.0f, 0.0f, 0.5f, 0.0f, 0.0f, 0.5f, 0.0f, 0.0f, 0.5f, 0.0f, -1.0f, -0.5f, 0.0f, -1.0f }; GLfloat boxNormals[] = { 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f }; ShaderManager shaderManager; MatrixStack mv; Frustum p; TransformPipeline pipeline; ExampleApplication::ExampleApplication() { boxVBO = NULL; floorVBO = NULL; boxTexture = NULL; floorTexture = NULL; x = 0.0f; y = 0.0f; z = 0.0f; yRot = 0.0f; } ExampleApplication::~ExampleApplication() { delete boxVBO; boxVBO = NULL; delete floorVBO; floorVBO = NULL; delete boxTexture; boxTexture = NULL; delete floorTexture; floorTexture = NULL; } void ExampleApplication::setup() { glEnable( GL_DEPTH_TEST ); glClearColor( 0.3f, 0.3f, 0.3f, 1.0f ); boxVBO = new VertexBuffer(); boxVBO->buffer( 36, boxVertices, boxTexCoords, boxNormals ); floorVBO = new VertexBuffer(); floorVBO->buffer( 4, floorVertices, floorTexCoords, floorNormals ); bool ok = shaderManager.loadShaderFiles( "tex_light", "shaders/tex_light.vp", "shaders/tex_light.fp" ); assert( ok ); shaderManager.useProgram( "tex_light" ); mv.loadIdentity(); mv.translate( 0.0f, -0.5f, -0.5f ); pipeline.setup( &mv, &p ); TGAFile f; ok = f.load( "wood.tga" ); assert( ok ); boxTexture = new Texture2D(); boxTexture->bind( 0 ); boxTexture->loadImage( *f.getImage() ); f.clear(); ok = f.load( "floor.tga" ); assert( ok ); floorTexture = new Texture2D(); floorTexture->bind( 0 ); floorTexture->loadImage( *f.getImage() ); } void ExampleApplication::onResizeWindow( int w, int h ) { glViewport( 0, 0, w, h ); p.perspective( 90.0f, w/(float)h, 0.01f, 1000.0f ); } void ExampleApplication::onKeyDown( unsigned char key, int mouseX, int mouseY ) { switch( key ) { case 'w': z += ( 0.1f * cos( toRadian( yRot ) ) ); x -= ( 0.1f * sin( toRadian( yRot ) ) ); break; case 's': z -= ( 0.1f * cos( toRadian( yRot ) ) ); x += ( 0.1f * sin( toRadian( yRot ) ) ); break; case 'q': z += ( 0.1f * cos( toRadian( yRot - 90 ) ) ); x -= ( 0.1f * sin( toRadian( yRot - 90 ) ) ); break; case 'e': z += ( 0.1f * cos( toRadian( yRot + 90 ) ) ); x -= ( 0.1f * sin( toRadian( yRot + 90 ) ) ); break; case 'd': yRot += 5.0f; if( ( yRot > 359.5f ) && ( yRot < 360.5f ) ) yRot = 0.0f; break; case 'a': yRot -= 5.0f; if( ( yRot < -359.5f ) && ( yRot > -360.5f ) ) yRot = 0.0f; break; case 'c': y += 0.1f; break; case 'x': y -= 0.1f; break; } postRedisplay(); } void ExampleApplication::render() { glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); mv.push(); mv.translate( x, y, z ); mv.rotate( yRot, 0.0f, 1.0f, 0.0f ); GLint mvpLocation = glGetUniformLocation( shaderManager.getCurrentProgramId(), "mvp" ); assert( mvpLocation != -1 ); GLint samplerLocation = glGetUniformLocation( shaderManager.getCurrentProgramId(), "sampler" ); assert( samplerLocation != -1 ); GLint lightPositionLocation = glGetUniformLocation( shaderManager.getCurrentProgramId(), "lightPosition" ); assert( lightPositionLocation != -1 ); GLint lightPositionLocation2 = glGetUniformLocation( shaderManager.getCurrentProgramId(), "lightPosition2" ); assert( lightPositionLocation2 != -1 ); glUniformMatrix4fv( mvpLocation, 1, GL_FALSE, pipeline.getMVPMatrix() ); glUniform1i( samplerLocation, 0 ); glUniform3f( lightPositionLocation, -100.0f, 100.0f, 100.0f ); glUniform3f( lightPositionLocation2, 100.0f, 0.0f, -100.0f ); floorTexture->bind( 0 ); floorVBO->draw( GL_TRIANGLE_FAN ); boxTexture->bind( 0 ); boxVBO->draw(); mv.pop(); swapBuffers(); }
56df5b2686bfdd652f6163192a217099231be2ef
c0203751e2a057966cdf335c42b8d3b38d3e09f1
/cc/debug/paint_time_counter.h
a1950834b0fa0bb3dfb965051257ad498574c711
[ "BSD-3-Clause" ]
permissive
timopulkkinen/BubbleFish
8a39cb8f6c885602d8d2d3b30fdc6999348a8109
eae72cda503b24447ebc9cd167e2f1ea9c933ce5
refs/heads/master
2020-05-09T15:52:41.453111
2013-03-24T21:27:44
2013-03-24T21:27:44
6,156,585
1
1
null
null
null
null
UTF-8
C++
false
false
1,860
h
paint_time_counter.h
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CC_DEBUG_PAINT_TIME_COUNTER_H_ #define CC_DEBUG_PAINT_TIME_COUNTER_H_ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/time.h" #include "cc/debug/ring_buffer.h" namespace cc { // Maintains a history of paint times for each frame class PaintTimeCounter { public: static scoped_ptr<PaintTimeCounter> Create(); size_t HistorySize() const { return ring_buffer_.BufferSize(); } struct Entry { Entry() : commit_number(0) {} int commit_number; base::TimeDelta paint_time; base::TimeDelta rasterize_time; base::TimeDelta total_time() const { return paint_time + rasterize_time; } }; // n = 0 returns the oldest and // n = PaintTimeHistorySize() - 1 the most recent paint time. base::TimeDelta GetPaintTimeOfRecentFrame(const size_t& n) const; void SavePaintTime(const base::TimeDelta& total_paint_time, int commit_number); void SaveRasterizeTime(const base::TimeDelta& total_rasterize_time, int commit_number); void GetMinAndMaxPaintTime(base::TimeDelta* min, base::TimeDelta* max) const; void ClearHistory(); typedef RingBuffer<Entry, 200> RingBufferType; RingBufferType::Iterator Begin() const { return ring_buffer_.Begin(); } RingBufferType::Iterator End() const { return ring_buffer_.End(); } private: PaintTimeCounter(); RingBufferType ring_buffer_; base::TimeDelta last_total_paint_time_; base::TimeDelta last_total_rasterize_time_; bool can_save_paint_time_delta_; bool can_save_rasterize_time_delta_; DISALLOW_COPY_AND_ASSIGN(PaintTimeCounter); }; } // namespace cc #endif // CC_DEBUG_PAINT_TIME_COUNTER_H_
d6c309433e6b53c7a8510ffd086c789782b09663
a042bf4e1d185e06828f592238f272315fa00498
/number_sign.cpp
553290df7c1def3f015a7826aab4afa83a9d97dc
[]
no_license
yashwanth999/cpp_programs
46994460ac67b14b9c2ffaf20da297bec993db93
4aa1b2f5e19a6cbd128e6b0749f0c96e741f7b9d
refs/heads/master
2021-01-11T16:07:05.036126
2018-12-31T09:31:15
2018-12-31T09:31:15
80,007,503
0
0
null
null
null
null
UTF-8
C++
false
false
761
cpp
number_sign.cpp
#include<iostream> using namespace std; int main() { int number; char option; int positive_count =0, negative_count=0, zero_count =0; do { cout << "Enter the value of the number" <<endl; cin >> number; if(number == 0) { zero_count ++; } if ((number > 0) && (number < 32767)) { positive_count ++; } if ((number > -32767) && (number < 0)) { negative_count ++; } cout << "Do you want to enter another number" << endl; cout << "if YES; enter y" << endl; cin >> option; }while(option == 'y' ); cout << "positive numbers entered are " << positive_count << endl; cout << "negative numbers entered are " << negative_count << endl; cout << "zeros entered are " << zero_count << endl; return 0; }
d03ea2e22c488e5439e5aedbbddd8e7dad514e47
17478d9298936093c31dc16c356fdbf5a9e5dd7f
/online-judge-solutions/Codeforces/764A.cpp
d5f246430e57b2060ec8857a0757ba828f54a609
[]
no_license
lilberick/Competitive-programming
5b381aa7cd7736e1040974cde302d0d50521fc9d
c0b160e4abbd2c6d459604b60b8fef5d97d8d576
refs/heads/master
2023-04-02T13:30:21.143442
2023-03-22T14:52:43
2023-03-22T14:52:43
137,540,270
2
1
null
2018-10-04T06:13:11
2018-06-15T23:39:21
null
UTF-8
C++
false
false
372
cpp
764A.cpp
//https://codeforces.com/problemset/problem/764/A //Lang : GNU C++14 //Time : 15 ms //Memory : 0 KB #include<iostream> #include<numeric> using namespace std; int mcd(int a,int b){ if(b==0) return a; return mcd(b,a%b);//cuidar que a no sea (-) } int mcm(int a,int b){ return (a/mcd(a,b))*b; } int main(){ int n,m,z;cin>>n>>m>>z; cout<<z/mcm(n,m)<<endl; return 0; }
d55b3ce567ad3ea920b2b55e1c276b8228a0c649
ce450aaed32e26504b0f1b3b33c1f94d63eb5b55
/Euler_6.cpp
19910d58072e017ea8d779606f755bae5d37e465
[]
no_license
bronzecraft/EulerProject
1cc784893fd12fc0a6e14a052a76689543772774
980b2386473e364613ff62030cf5d98e68b3c251
refs/heads/main
2023-03-02T17:54:35.542748
2021-02-12T11:29:07
2021-02-12T11:29:07
312,124,205
0
0
null
null
null
null
UTF-8
C++
false
false
215
cpp
Euler_6.cpp
#include <iostream> int main() { int i = 1, m = 0, n = 1; for (int j = 100; j >= 1; j = j - 1) { for ( i = 1; i < j; i++) { m = m + 2 * j * i; } } std::cout << m << std::endl; return i; }
ac622159b26db75fca61646503ef22677ccf80f6
d076dc084bf083e29c52e2751608adc6e9cd1547
/cpp/IMC/Spec/FollowRefState.hpp
a2ffdbdbdaaed2bc7f19acadc1dc228574a8639a
[ "BSD-2-Clause" ]
permissive
laas/fire-rs-saop
2fda57fd86273dd81e1f29d25790e4aab5154400
321e16fceebf44e8e97b482c24f37fbf6dd7d162
refs/heads/master
2021-07-19T03:14:29.799658
2021-07-09T09:18:29
2021-07-09T09:18:29
105,798,055
17
5
BSD-2-Clause
2021-07-09T09:18:30
2017-10-04T17:36:40
C++
UTF-8
C++
false
false
7,016
hpp
FollowRefState.hpp
//*************************************************************************** // Copyright 2017 OceanScan - Marine Systems & Technology, Lda. * //*************************************************************************** // Licensed under the Apache License, Version 2.0 (the "License"); * // you may not use this file except in compliance with the License. * // You may obtain a copy of the License at * // * // http://www.apache.org/licenses/LICENSE-2.0 * // * // Unless required by applicable law or agreed to in writing, software * // distributed under the License is distributed on an "AS IS" BASIS, * // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * // See the License for the specific language governing permissions and * // limitations under the License. * //*************************************************************************** // Author: Ricardo Martins * //*************************************************************************** // Automatically generated. * //*************************************************************************** // IMC XML MD5: 4d8734a1111656aac56f803acdc90c22 * //*************************************************************************** #ifndef IMC_FOLLOWREFSTATE_HPP_INCLUDED_ #define IMC_FOLLOWREFSTATE_HPP_INCLUDED_ // ISO C++ 98 headers. #include <ostream> #include <string> #include <vector> // IMC headers. #include "../Base/Config.hpp" #include "../Base/Message.hpp" #include "../Base/InlineMessage.hpp" #include "../Base/MessageList.hpp" #include "../Base/JSON.hpp" #include "../Base/Serialization.hpp" #include "../Spec/Enumerations.hpp" #include "../Spec/Bitfields.hpp" #include "../Spec/Reference.hpp" namespace IMC { //! Follow Reference State. class FollowRefState: public Message { public: //! State. enum StateEnum { //! Waiting for first reference. FR_WAIT = 1, //! Going towards received reference. FR_GOTO = 2, //! Loitering after arriving at the reference. FR_LOITER = 3, //! Hovering after arriving at the reference. FR_HOVER = 4, //! Moving in z after arriving at the target cylinder. FR_ELEVATOR = 5, //! Controlling system timed out. FR_TIMEOUT = 6 }; //! Proximity. enum ProximityBits { //! Far from the destination. PROX_FAR = 0x01, //! Near in the horizontal plane. PROX_XY_NEAR = 0x02, //! Near in the vertical plane. PROX_Z_NEAR = 0x04 }; //! Controlling Source. uint16_t control_src; //! Controlling Entity. uint8_t control_ent; //! Reference. InlineMessage<Reference> reference; //! State. uint8_t state; //! Proximity. uint8_t proximity; static uint16_t getIdStatic(void) { return 480; } static FollowRefState* cast(Message* msg__) { return (FollowRefState*)msg__; } FollowRefState(void) { m_header.mgid = FollowRefState::getIdStatic(); clear(); reference.setParent(this); } FollowRefState* clone(void) const { return new FollowRefState(*this); } void clear(void) { control_src = 0; control_ent = 0; reference.clear(); state = 0; proximity = 0; } bool fieldsEqual(const Message& msg__) const { const IMC::FollowRefState& other__ = static_cast<const FollowRefState&>(msg__); if (control_src != other__.control_src) return false; if (control_ent != other__.control_ent) return false; if (reference != other__.reference) return false; if (state != other__.state) return false; if (proximity != other__.proximity) return false; return true; } uint8_t* serializeFields(uint8_t* bfr__) const { uint8_t* ptr__ = bfr__; ptr__ += IMC::serialize(control_src, ptr__); ptr__ += IMC::serialize(control_ent, ptr__); ptr__ += reference.serialize(ptr__); ptr__ += IMC::serialize(state, ptr__); ptr__ += IMC::serialize(proximity, ptr__); return ptr__; } size_t deserializeFields(const uint8_t* bfr__, size_t size__) { const uint8_t* start__ = bfr__; bfr__ += IMC::deserialize(control_src, bfr__, size__); bfr__ += IMC::deserialize(control_ent, bfr__, size__); bfr__ += reference.deserialize(bfr__, size__); bfr__ += IMC::deserialize(state, bfr__, size__); bfr__ += IMC::deserialize(proximity, bfr__, size__); return bfr__ - start__; } size_t reverseDeserializeFields(const uint8_t* bfr__, size_t size__) { const uint8_t* start__ = bfr__; bfr__ += IMC::reverseDeserialize(control_src, bfr__, size__); bfr__ += IMC::deserialize(control_ent, bfr__, size__); bfr__ += reference.reverseDeserialize(bfr__, size__); bfr__ += IMC::deserialize(state, bfr__, size__); bfr__ += IMC::deserialize(proximity, bfr__, size__); return bfr__ - start__; } uint16_t getId(void) const { return FollowRefState::getIdStatic(); } const char* getName(void) const { return "FollowRefState"; } size_t getFixedSerializationSize(void) const { return 5; } size_t getVariableSerializationSize(void) const { return reference.getSerializationSize(); } void fieldsToJSON(std::ostream& os__, unsigned nindent__) const { IMC::toJSON(os__, "control_src", control_src, nindent__); IMC::toJSON(os__, "control_ent", control_ent, nindent__); reference.toJSON(os__, "reference", nindent__); IMC::toJSON(os__, "state", state, nindent__); IMC::toJSON(os__, "proximity", proximity, nindent__); } protected: void setTimeStampNested(double value__) { if (!reference.isNull()) { reference.get()->setTimeStamp(value__); } } void setSourceNested(uint16_t value__) { if (!reference.isNull()) { reference.get()->setSource(value__); } } void setSourceEntityNested(uint8_t value__) { if (!reference.isNull()) { reference.get()->setSourceEntity(value__); } } void setDestinationNested(uint16_t value__) { if (!reference.isNull()) { reference.get()->setDestination(value__); } } void setDestinationEntityNested(uint8_t value__) { if (!reference.isNull()) { reference.get()->setDestinationEntity(value__); } } }; } #endif
b77240bc73f9de528260ea169150b7330912b2e0
625fa2d10a20d4f8db88e19b5c272fe574be2d7b
/Classes/data/Pet.h
87c39454a5ee07882ccf4025918b421becd8a4b0
[]
no_license
Crasader/life
020ada76728f90ee6ba11a0ef465746d1d716172
69b68d6dd3fe37fc3081f7f92701750bd3afd3c5
refs/heads/master
2020-12-26T14:55:42.684115
2018-07-18T02:30:03
2018-07-18T02:30:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,787
h
Pet.h
// // Pet.h // life // // Created by ff on 17/7/28. // // #ifndef Pet_h #define Pet_h #include "cocos2d.h" #include "cocostudio/CocoStudio.h" #include "utils/GameUtils.h" typedef struct __PET_CONFIG { int petId; std::string name; std::string icon; std::string image; std::string pvpImg; std::string skillName; int fighterId; int skillId; int relation[2]; int quality; }PET_CONFIG; typedef struct __PET_LEVEL_CONFIG { int levelId; int qualityId; int level; int costFragment; int deltaHp; int deltaAttack; int deltaDefence; int provHp; int provCritRate; int provCirtPercent; }PET_LEVEL_CONFIG; typedef struct __PET_DATA { int petId; int level; int fragmentCount; }PET_DATA; typedef struct __PET_INFO { int hp; int attack; int defence; int fightPet[3]; }PET_INFO; class Pet : public Singleton<Pet> { public: Pet(); ~Pet(); void readPetConfigFile(); void readLevelConfigFile(); void deleteJson(); bool readJson(); bool parseJson(); void save2Json(); void save2EmptyCoreStr(); void deletePetJson(); bool readPetJson(); bool parsePetJson(); void save2PetJson(); void save2EmptyPetStr(); int getFightPetCount(); int addFightPet(int petId); bool removeFightPet(int pos); int uplevel(int petId); bool isMaxLevel(int petId); int getLevelId(int quality, int petLevel); int checkFragment(int petId); int getNextLevelId(int petId); bool addFragment(int petId, int count); void getRelations(int petId, std::vector<int> &relation); void getPetsWithSameRelation(int relationId, std::vector<int> &petsId); void getPetsWithQuality(int quality, std::vector<int> &petsId); void checkTip(); public: static std::map<int, int> petConfigIdTable; static std::map<int, int> levelConfigIdTable; std::map<int, PET_CONFIG> petConfigMap; std::map<int, PET_LEVEL_CONFIG> levelConfigMap; std::map<int, PET_DATA> petsMap; std::map<int, int> maxLevel; std::vector<bool> uplevelTip; private: CC_SYNTHESIZE_READONLY(PET_INFO, info, Info); CC_SYNTHESIZE_READONLY(std::string, coreStr, CoreStr); CC_SYNTHESIZE_READONLY(std::string, petsStr, PetsStr); CC_SYNTHESIZE_READONLY(bool, tip, Tip); }; #endif /* Pet_h */
1437e290151f9f19040821bb9960d6d99b93819f
9128e28d7ed04e8623d3a94980276d8ca4362d9e
/Practikums/Iterators and Smart pointers/Task03/main.cpp
684d7e3752acb42bccc846936665fff429b338f4
[]
no_license
snikolova27/OOP-2021
ac3317fc4cab4b6970a96482acbb7ef37389edd8
8c1bea8be690aa498d5cb248ac1a7a45abe7032a
refs/heads/main
2023-06-25T03:29:53.123503
2021-07-24T14:43:02
2021-07-24T14:43:02
null
0
0
null
null
null
null
UTF-8
C++
false
false
598
cpp
main.cpp
#include "Park.h" #include <iostream> #include <memory> int main() { std::string name; std::cout << "Enter name of park" <<std::endl; std::getline(std::cin, name); Park* park = new Park(name); std::cout << park->getName() << std::endl; delete park; std::unique_ptr <Park> uniquePark(new Park(name)); std::cout << uniquePark->getName() << std::endl; std::shared_ptr <Park> shrdPark1(new Park(name)); std::shared_ptr <Park> shrdPark2(shrdPark1); std::shared_ptr<Park> shrdPark3(shrdPark2); std::cout << shrdPark3->getName(); return 0; }
6d9056818158527485ac013d6b250f1c3cc60380
2fd8cd1b9db4e9c1605ca306ac86f2cdab1af3e8
/src/test_std_find_if.cpp
1b47e98538386e761097fbb564658aa343ecba54
[]
no_license
commshare/testCPP
f2642eabd0c65669f479e4db6791ade727257bc7
81ec9e84df7f133513335ce55ad9b17c38cb7910
refs/heads/master
2020-04-05T14:38:56.977803
2020-02-25T09:23:51
2020-02-25T09:23:51
41,774,178
0
0
null
null
null
null
GB18030
C++
false
false
1,850
cpp
test_std_find_if.cpp
#include <iostream> #include <map> #include <algorithm> //https://www.cnblogs.com/motadou/archive/2009/02/01/1561549.html /* class map_finder即用于比较的函数对象,它的核心就是重载的()运算符。 因为每个容器迭代器的*运算符得到的结果都是该容器的value_type值, 所以该运算符的形参就是map迭代器指向的value_type类型的引用。 而map的value_type到底是什么类型,就得看下STL的源代码是如何定义的。 template <class Key, class T, class Compare = less<Key>, class Alloc = alloc> class map { public: typedef Key key_type; typedef pair<const Key, T> value_type; ...... }; 从上面的定义可以看出,map的value_type是std::pair<const Key, t>类型,它的first值就是关键字,second值保存map的值域。 */ class map_finder { public: map_finder(const std::string &cmp_string):m_s_cmp_string(cmp_string) { } //重载() bool operator() (const std::map <int , std::string >::value_type &pair ) { return pair.second == m_s_cmp_string; } private: const std::string &m_s_cmp_string; } ; int main() { std::map <int ,std::string> my_map; my_map.insert(std::make_pair(10,"china")); my_map.insert(std::make_pair(20,"usa")); my_map.insert(std::make_pair(30, "english")); my_map.insert(std::make_pair(40,"hongk")); std::map<int , std::string>::iterator it = my_map.end(); #if 0 it = std::find_if(my_map.begin(),my_map.end(),map_finder("china")) ; #else std::string cmpstr = "china"; //lamda it = std::find_if(my_map.begin(),my_map.end(), [=](decltype(my_map)::value_type &pair) { return pair.second == cmpstr; } ) ; #endif if(it == my_map.end()) { printf("not find \n"); }else { printf(" found key %d value %s \n",it->first,it->second.c_str()); } return 0; }
ce8cfbe9ab0cb8dae18cfd717d095063e93c1256
7e1b064185855fa9b5072542a72c16613c71ac74
/src/main.cpp
253c4c7339e078aa5fed1d4a79d0f529b5a57b59
[]
no_license
Nikanorich/geometry
63260ef1f4bca3b4131b69efd04576a7b51d5bb4
1e2b109cdae3eeabf730fee3b614f0c26dd71363
refs/heads/master
2021-05-17T05:00:45.575819
2020-03-28T14:30:40
2020-03-28T14:30:40
250,637,246
0
0
null
null
null
null
UTF-8
C++
false
false
388
cpp
main.cpp
#include "func.h" #include <bits/stdc++.h> using namespace std; int main() { int x, y, r; int x1, x2, y1, y2, x3, y3; int Var = menu(); switch (Var) { case 1: { cin >> x >> y >> r; circle(x, y, r); break; } case 2: { cin >> x1 >> x2 >> x3 >> y1 >> y2 >> y3; triangle(x1, x2, x3, y1, y2, y3); break; } } }
16ae76fdf494199690e6387a770ab8f7d8d6b71c
98544ccaf08da72ad656fe673e023122035d6fc9
/CL-Include/source/Options.cpp
e3e449940922b1826e84d89f51b62db95245b1a7
[ "MIT" ]
permissive
MathiasMagnus/Test-Applications
b4ad4668d8be389b78146811a2ce2ddd5bd14059
bbb284f2d864866908dd5d36230f1bf54a56ea4c
refs/heads/master
2022-12-01T10:39:52.099603
2022-11-15T12:47:01
2022-11-15T12:47:01
117,245,246
0
0
null
null
null
null
UTF-8
C++
false
false
2,130
cpp
Options.cpp
// CL-Include includes #include <CL-Include-config.hpp> // kernels_path #include <Options.hpp> // TCLAP includes #include <tclap/CmdLine.h> // STL includes #include <sstream> cli::options cli::parse(int argc, char** argv, const std::string banner) { try { TCLAP::CmdLine cli(banner); TCLAP::ValueArg<std::size_t> length_arg("l", "length", "Length of input", false, 262144, "positive integral", cli); TCLAP::ValueArg<std::size_t> platform_arg("p", "platform", "Index of platform to use", false, 0, "positive integral", cli ); TCLAP::ValueArg<std::size_t> device_arg("d", "device", "Number of input points", false, 0, "positive integral", cli); std::vector<std::string> valid_dev_strings{ "all", "cpu", "gpu", "acc", "host" }; TCLAP::ValuesConstraint<std::string> valid_dev_constraint{ valid_dev_strings }; TCLAP::ValueArg<std::string> type_arg{ "t", "type","Type of device to use", false, "all", &valid_dev_constraint , cli }; auto device_type = [](std::string in) -> cl_device_type { if (in == "all") return CL_DEVICE_TYPE_ALL; else if (in == "cpu") return CL_DEVICE_TYPE_CPU; else if (in == "gpu") return CL_DEVICE_TYPE_GPU; else if (in == "acc") return CL_DEVICE_TYPE_ACCELERATOR; else throw std::logic_error{ "Unkown device type after cli parse. Should not have happened." }; }; TCLAP::SwitchArg quiet_arg("q", "quiet", "Suppress standard output", false); cli.add(quiet_arg); cli.parse(argc, argv); return { length_arg.getValue(), platform_arg.getValue(), device_arg.getValue(), device_type(type_arg.getValue()), quiet_arg.getValue() }; } catch (TCLAP::ArgException e) { std::stringstream ss; ss << e.what() << std::endl; ss << "error: " << e.error() << " for arg " << e.argId(); throw cli::error{ ss.str().c_str() }; } catch (std::logic_error e) { std::stringstream ss; ss << e.what(); throw cli::error{ e.what() }; } }
f30ffaee2fe65bb182659b399aa4d7e58d8a0ac7
73ac0a30b6da1e04d85f355337edacd4b21a074c
/Source/Applications/Firestorm/FirestormApp.cpp
5360b7b12988820d6a543e2889d3d5e4b364de1d
[]
no_license
fool404/Firestorm
f73279715ec162bb4f04cfadd8ee8099d89fde7a
fe58e3ce2bb653d49047d52bc4d1f2b2f407ab44
refs/heads/master
2021-09-28T03:44:30.001118
2018-11-12T19:26:42
2018-11-12T19:26:42
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,418
cpp
FirestormApp.cpp
#include "stdafx.h" #include "FirestormApp.h" #include <libCore/Logger.h> #include <LLGL/LLGL.h> #include <LLGL/VertexAttribute.h> #include <LLGL/VertexFormat.h> #include <libIO/libIO.h> #include <libIO/ResourceMgr.h> #include <libScene/ShaderProgramResource.h> #include <libScene/MeshResource.h> #include <libScene/SceneGraphResource.h> FirestormApp::FirestormApp(std::thread::id mainThreadID) : Application(mainThreadID) { } FirestormApp::~FirestormApp() { RenderMgr& renderMgr = GetSystems().GetRenderMgr(); renderMgr.System->Release(*_commandBuffer); renderMgr.System->Release(*_pipeline); renderMgr.System->Release(*_vertexBuffer); } void FirestormApp::OnInitialize(int ac, char** av) { RegisterResourceTypes(); EnableWindowResizing(true); FIRE_ASSERT(libIO::FileExists("/Shaders/Triangle.shader")); FIRE_ASSERT(libIO::FileExists("/Models/base-female.gltf")); RenderMgr& renderMgr = GetSystems().GetRenderMgr(); Dispatcher.Register<ApplicationWantsToCloseEvent>([this](const ApplicationWantsToCloseEvent& e) { HandleApplicationWantsToClose(e); });// &FirestormApp::HandleApplicationWantsToClose, this); struct Vertex { Vector2 position; Vector4 color; }; const float s = 0.5f; Vertex vertices[] = { { { 0, s }, { 1, 0, 0, 1 } }, { { s, -s }, { 0, 1, 0, 1 } }, { { -s, -s }, { 0, 0, 1, 1 } } }; LLGL::VertexFormat vertexFormat; vertexFormat.AppendAttribute({ "position", LLGL::Format::RG32Float }); vertexFormat.AppendAttribute({ "color", LLGL::Format::RGBA32Float }); vertexFormat.stride = sizeof(Vertex); LLGL::BufferDescriptor vertexBufferDesc; { vertexBufferDesc.type = LLGL::BufferType::Vertex; vertexBufferDesc.size = sizeof(vertices); vertexBufferDesc.vertexBuffer.format = vertexFormat; } _vertexBuffer = renderMgr.System->CreateBuffer(vertexBufferDesc, vertices); auto& resourceMgr = GetSystems().GetResourceMgr(); ResourceReference shaderRef("/Shaders/Triangle.shader"); ResourceReference sceneRef("/Models/base-female.gltf"); _shaderResource = resourceMgr.Load<ShaderProgramResource>(shaderRef); _sceneGraphResource = resourceMgr.Load<SceneGraphResource>(sceneRef); while(true) { if(_shaderResource.IsFinished() && _sceneGraphResource.IsFinished()) { break; } std::this_thread::sleep_for(std::chrono::milliseconds(1)); } FIRE_ASSERT_MSG(!_shaderResource.HasError(), Format("Error Loading Shader: %s", _shaderResource.GetError().Format())); FIRE_ASSERT_MSG(!_sceneGraphResource.HasError(), Format("Error Loading Mesh: %s", _sceneGraphResource.GetError().Format())); auto resource = _shaderResource.Get<ShaderProgramResource>(); LLGL::GraphicsPipelineDescriptor pipelineDesc; { pipelineDesc.shaderProgram = resource->Compile({vertexFormat}); pipelineDesc.renderPass = renderMgr.Context->GetRenderPass(); } _pipeline = renderMgr.System->CreateGraphicsPipeline(pipelineDesc); _commandQueue = renderMgr.System->GetCommandQueue(); FIRE_ASSERT(_commandQueue != nullptr); _commandBuffer = renderMgr.System->CreateCommandBuffer(); FIRE_ASSERT(_commandBuffer != nullptr); } void FirestormApp::OnRender() { try { if(_commandBuffer == nullptr) return; auto& renderMgr = GetSystems().GetRenderMgr(); _commandBuffer->Begin(); { Vector2 res(GetResolution()); _commandBuffer->SetViewport(LLGL::Viewport{ LLGL::Offset2D{0,0}, LLGL::Extent2D{800,600} }); _commandBuffer->SetGraphicsPipeline(*_pipeline); _commandBuffer->SetVertexBuffer(*_vertexBuffer); _commandBuffer->BeginRenderPass(*renderMgr.Context); { _commandBuffer->Clear(LLGL::ClearFlags::Color); _commandBuffer->Draw(3, 0); } _commandBuffer->EndRenderPass(); } _commandBuffer->End(); _commandQueue->Submit(*_commandBuffer); } catch(std::exception& e) { FIRE_LOG_ERROR(e.what()); Close(); } } void FirestormApp::OnClose() { } int FirestormApp::OnShutdown() { return 0; } void FirestormApp::HandleApplicationWantsToClose(const ApplicationWantsToCloseEvent& event) { event.App->AllowClose(); } void FirestormApp::RegisterResourceTypes() { // Register the resource types. auto& systems = GetSystems(); auto& renderMgr = systems.GetRenderMgr(); auto& resourceMgr = systems.GetResourceMgr(); resourceMgr.InstallLoader<ShaderProgramResource>(renderMgr); resourceMgr.InstallLoader<MeshResource>(renderMgr); resourceMgr.InstallLoader<SceneGraphResource>(renderMgr); }
4e620971532fb40d3fa79535f7a74aeaff75a99a
a9cfe15b0ad66704ea25f6b3f5cbedf10666b9ed
/DataBaseC/test.cpp
bf38b752e39aa5feaafebbf012233a86f7574507
[]
no_license
terrabayt/KPI-study
04a475050f46c76297933239006a1b779d726263
27766cf58119bd09f92b309adba6ab95e4653c8c
refs/heads/master
2020-07-09T15:12:48.279588
2016-09-06T21:57:29
2016-09-06T21:57:29
67,548,346
1
1
null
null
null
null
UTF-8
C++
false
false
431
cpp
test.cpp
#define _CRT_SECURE_NO_WARNINGS #include "database.h" using namespace std; int main(){ DataBase db; int LoadRes = db.loadFromFile("file.csv"); db.displayAll(); db.arrangeSubordinates(); cout << "After arranging\n"; db.displayAll(); cout << "Fire id 3\n"; db.fireEmployee(3); db.displayAll(); cout << "All employees of 'IT' department\n"; db.displayDepartmentEmployees("IT"); system("pause"); return 0; }
0c4f132306a34a237ca966a6c9322a54aed61255
c47c512f2d60e44109de886c5908a4ac1f1eaad1
/bin/runHcalAnalysis.cc
c224619fe7f10106a95e0b010ff9f48018e97691
[]
no_license
georgia14/HcalTPAnalyzer
53a701227e8db209edd27d11c0dfcddd04d6d726
17dcbf8f05d0bb8d5e4c018b8c1c3217f44e200c
refs/heads/master
2021-07-07T17:37:10.842350
2017-10-03T08:08:06
2017-10-03T08:08:06
105,626,003
0
1
null
null
null
null
UTF-8
C++
false
false
11,761
cc
runHcalAnalysis.cc
#include <iostream> #include "FWCore/FWLite/interface/FWLiteEnabler.h" #include "FWCore/PythonParameterSet/interface/MakeParameterSets.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "UserCode/HcalTPAnalyzer/interface/MacroUtils.h" #include "UserCode/HcalTPAnalyzer/interface/HcalEvent.h" #include "UserCode/HcalTPAnalyzer/interface/DataEvtSummaryHandler.h" #include "UserCode/HcalTPAnalyzer/interface/SmartSelectionMonitor.h" #include "TSystem.h" #include "TFile.h" #include "TTree.h" #include "TCanvas.h" #include "TH1F.h" #include "TH2F.h" #include "TProfile.h" #include "TEventList.h" #include "TROOT.h" #include "TMath.h" using namespace std; // offline thresholds const int adc_threshold_hbhe=1; const int adc_threshold_hf=5; const float tp_threshold=0.5; int main(int argc, char* argv[]) { //################################################################################## //########################## GLOBAL INITIALIZATION ########################## //################################################################################## // check arguments if(argc<2) { std::cout << "Usage : " << argv[0] << " parameters_cfg.py" << std::endl; exit(0); } // load framework libraries gSystem->Load( "libFWCoreFWLite" ); //AutoLibraryLoader::enable(); FWLiteEnabler::enable(); // configure the process const edm::ParameterSet &runProcess = edm::readPSetsFrom(argv[1])->getParameter<edm::ParameterSet>("runProcess"); bool isMC = runProcess.getParameter<bool>("isMC"); TString dtag=runProcess.getParameter<std::string>("tag"); TString suffix=runProcess.getParameter<std::string>("suffix"); bool verbose = runProcess.getParameter<bool>("verbose"); TString url = runProcess.getParameter<std::string>("input"); TString outFileUrl( dtag ); //gSystem->BaseName(url)); // outFileUrl.ReplaceAll(".root",""); TString outdir=runProcess.getParameter<std::string>("outdir"); TString outUrl( outdir ); gSystem->Exec("mkdir -p " + outUrl); TString outTxtUrl_final= outUrl + "/" + outFileUrl + "_FinalList.txt"; FILE* outTxtFile_final = NULL; outTxtFile_final = fopen(outTxtUrl_final.Data(), "w"); printf("TextFile URL = %s\n",outTxtUrl_final.Data()); fprintf(outTxtFile_final,"run lumi event\n"); // int fType(0); // if(url.Contains("ZeroBias")) fType=ZB; // if(url.Contains("JetHT")) fType=JetHT; bool is2016(!isMC && url.Contains("283171")); bool isZeroBias(!isMC && url.Contains("ZeroBias")); bool isJetHTPD(!isMC && url.Contains("JetHT")); bool isMC_QCD = isMC && (string(url.Data()).find("QCD") != string::npos); if (isZeroBias) printf("Data url = %s\n",url.Data()); //tree info int evStart = runProcess.getParameter<int>("evStart"); int evEnd = runProcess.getParameter<int>("evEnd"); TString dirname = runProcess.getParameter<std::string>("dirName"); //################################################################################## //########################## INITIATING HISTOGRAMS ########################## //################################################################################## SmartSelectionMonitor mon; // GEN level kinematics // mon.addHistogram( new TH1F( "higgsMass",";m_{h} [GeV];Events",200,0.,600.) ); mon.addHistogram( new TH2F("tp_occupancy",";TP ieta; TP iphi",84, -42, 42, 90, 0, 90) ); mon.addHistogram( new TH1F("adc",";adc count;a.u.",250,0,250) ); mon.addHistogram( new TH1F("soi",";uncompressed E_{T} (SOI);a.u.",250,0,250) ); mon.addHistogram( new TH1F("npre",";# presamples;a.u.",10,-0.5,9.5) ); mon.addHistogram( new TH1F("ntp",";#TPs;a.u.",800, -0.5, 799.5) ); mon.addHistogram( new TH1F("etp",";#sum TPs E_{T};a.u.", 200, -0.5, 599.5) ); mon.addHistogram( new TH2F("ntp_vs_nvtx",";#nvtx; Number of TPs",100,-0.5, 99.5, 800, -0.5, 799.5) ); mon.addHistogram( new TH2F("etp_vs_nvtx",";#nvtx; Sum TPs E_{T}",100,-0.5, 99.5, 200, -0.5, 599.5) ); // //for MC normalization (to 1/pb) // TH1F* Hcutflow = (TH1F*) mon.addHistogram( new TH1F ("cutflow" , "cutflow" ,6,0,6) ) ; // TH1F *h1 = (TH1F*) mon.addHistogram( new TH1F( "nleptons_raw", ";Lepton multiplicity;Events", 4,0,4) ); // for(int ibin=1; ibin<=h1->GetXaxis()->GetNbins(); ibin++) { // TString label(""); // if(ibin==h1->GetXaxis()->GetNbins()) label +="#geq"; // else label +="="; // label += (ibin-1); // h1->GetXaxis()->SetBinLabel(ibin,label); // } //################################################################################## //############# GET READY FOR THE EVENT LOOP ##################### //################################################################################## //open the file and get events tree DataEvtSummaryHandler summaryHandler_; TFile *file = TFile::Open(url); printf("Looping on %s\n",url.Data()); if(file==0) { return -1; printf("file is 0"); } if(file->IsZombie()) return -1; if( !summaryHandler_.attachToTree( (TTree *)file->Get(dirname) ) ) { file->Close(); return -1; } //check run range to compute scale factor (if not all entries are used) const Int_t totalEntries= summaryHandler_.getEntries(); float rescaleFactor( evEnd>0 ? float(totalEntries)/float(evEnd-evStart) : -1 ); if(evEnd<0 || evEnd>summaryHandler_.getEntries() ) evEnd=totalEntries; if(evStart > evEnd ) { file->Close(); return -1; } //MC normalization (to 1/pb) double xsecWeight = 1.0; // float cnorm=1.0; // if (isMC) { // double totalNumberofEvents; // TH1F* nevtH = (TH1F *) file->Get("mainNtuplizer/nevents"); // totalNumberofEvents = nevtH->GetBinContent(1); // TH1F* posH = (TH1F *) file->Get("mainNtuplizer/n_posevents"); // TH1F* negH = (TH1F *) file->Get("mainNtuplizer/n_negevents"); // if(posH && negH) cnorm = posH->GetBinContent(1) - negH->GetBinContent(1); // if(rescaleFactor>0) cnorm /= rescaleFactor; // printf("cnorm = %f\n",cnorm); // xsecWeight=xsec/totalNumberofEvents; // } // Hcutflow->SetBinContent(1,cnorm); // //pileup weighting // TString PU_Central = runProcess.getParameter<std::string>("pu_central"); // gSystem->ExpandPathName(PU_Central); // cout << "Loading PU weights Central: " << PU_Central << endl; // TFile *PU_Central_File = TFile::Open(PU_Central); // TH1F* weight_pileup_Central = (TH1F *) PU_Central_File->Get("pileup"); //#################################################################################################################### //########################################### EVENT LOOP ########################################### //#################################################################################################################### // loop on all the events int treeStep = (evEnd-evStart)/50; if(treeStep==0)treeStep=1; printf("Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n"); printf("Scanning the ntuple :"); for( int iev=evStart; iev<evEnd; iev++) { if((iev-evStart)%treeStep==0) { printf("."); fflush(stdout); } if ( verbose ) printf("\n\n Event info %3d: \n",iev); //############################################## EVENT LOOP STARTS ############################################## //load the event content from tree summaryHandler_.getEntry(iev); DataEvtSummary_t &ev=summaryHandler_.getEvent(); // if(!isMC && duplicatesChecker.isDuplicate( ev.run, ev.lumi, ev.event) ) { // nDuplicates++; // cout << "nDuplicates: " << nDuplicates << endl; // continue; // } std::vector<TString> tags(1,"all"); //systematical weight float weight = 1.0; //xsecWeight; if(isMC) weight *= xsecWeight; // add PhysicsEvent_t class, get all tree to physics objects HcalEvent_t phys=getHcalEventFrom(ev); if (!phys.hasTrigger) continue; //######################################################################### //##################### Objects Selection ###################### //######################################################################### HcalTriggerPrimitiveCollection &hcal_tps = phys.hcaltps; int ntp_hb_, ntp_he_, ntp_hf_; ntp_hb_=ntp_he_=ntp_hf_= 0; float sum_hb_, sum_he_, sum_hf_; sum_hb_=sum_he_=sum_hf_=0.; for (auto & it : hcal_tps) { float tp_et=it.et; if (is2016 && abs(it.ieta) > 29) tp_et /= 0.7; // Cut on a minimun TP Et > 0.5 if (tp_et < tp_threshold) continue; // if (it.soi < adc_threshold) // continue; // adc count integrated float adc_=0.; for (int i=0; i<10; i++) { adc_+=it.adc[i]; } // Remove HEP17 region if (it.ieta<=29 && it.ieta>=17 && it.iphi>=63 && it.iphi<=66) continue; // TP occupancy vs ieta mon.fillHisto("tp_occupancy","tps",it.ieta,it.iphi,weight); // Number of TPs if (abs(it.ieta) <= 16) { ++ntp_hb_; sum_hb_+= tp_et; mon.fillHisto("adc","hb",adc_,weight); mon.fillHisto("soi","hb",it.soi,weight); if (phys.nvtx==25.) { mon.fillHisto("adc","hb_vtx25",adc_,weight); mon.fillHisto("soi","hb_vtx25",it.soi,weight); } mon.fillHisto("npre","hb",it.npresamples,weight); } else if (abs(it.ieta) <= 29) { ++ntp_he_; sum_he_+=tp_et; mon.fillHisto("adc","he",adc_,weight); mon.fillHisto("soi","he",it.soi,weight); if (phys.nvtx==25.) { mon.fillHisto("adc","he_vtx25",adc_,weight); mon.fillHisto("soi","he_vtx25",it.soi,weight); } mon.fillHisto("npre","he",it.npresamples,weight); } else { if (it.version==1) { ++ntp_hf_; sum_hf_+=tp_et; mon.fillHisto("adc","hf",adc_,weight); mon.fillHisto("soi","hf",it.soi,weight); if (phys.nvtx==25.) { mon.fillHisto("adc","hf_vtx25",adc_,weight); mon.fillHisto("soi","hf_vtx25",it.soi,weight); } mon.fillHisto("npre","hf",it.npresamples,weight); } } } // loop on hcal_tps if (phys.nvtx==25.) { mon.fillHisto("ntp","hb_vtx25",ntp_hb_,weight); mon.fillHisto("ntp","he_vtx25",ntp_he_,weight); mon.fillHisto("ntp","hf_vtx25",ntp_hf_,weight); mon.fillHisto("etp","hb_vtx25",sum_hb_,weight); mon.fillHisto("etp","he_vtx25",sum_he_,weight); mon.fillHisto("etp","hf_vtx25",sum_hf_,weight); } // TP occupancy / Sum ET vs : nvtx mon.fillHisto("ntp_vs_nvtx","hb",phys.nvtx,ntp_hb_,weight); mon.fillHisto("etp_vs_nvtx","hb",phys.nvtx,sum_hb_,weight); mon.fillHisto("ntp_vs_nvtx","he",phys.nvtx,ntp_he_,weight); mon.fillHisto("etp_vs_nvtx","he",phys.nvtx,sum_he_,weight); mon.fillHisto("ntp_vs_nvtx","hf",phys.nvtx,ntp_hf_,weight); mon.fillHisto("etp_vs_nvtx","hf",phys.nvtx,sum_hf_,weight); } // loop on all events END printf("\n"); file->Close(); //############################################## //######## SAVING HISTO TO FILE ######## //############################################## //save control plots to file outUrl += "/"; outUrl += outFileUrl + ".root"; printf("Results saved in %s\n", outUrl.Data()); //save all to the file TFile *ofile=TFile::Open(outUrl, "recreate"); mon.Write(); ofile->Close(); if(outTxtFile_final)fclose(outTxtFile_final); }
ffb784f64c3cd5d1e3581ccee6cd294dd3f8e6eb
94db361f9d28fcb80156432a15a31de00a491d03
/IntentoSeparacion/Posicion.cpp
b223b47820afbc1c54ca00090c1f5fe1285fb46e
[]
no_license
JohelPF/Proyecto_1_E.D
fa05393af8a545b0eaa1958d81bd60c28a14d04c
65a98bc240e078b98ebb6c1e6d4d91b993011735
refs/heads/master
2022-11-18T00:21:57.678661
2020-07-20T00:32:31
2020-07-20T00:32:31
279,469,136
0
0
null
null
null
null
UTF-8
C++
false
false
2,722
cpp
Posicion.cpp
#include <iostream> #include <vector> using namespace std; typedef struct _Posicion{ string palabra; vector<int> linea; vector<int> posicion; _Posicion *siguiente = NULL; }Posicion; Posicion *primpos = NULL; bool EnPosicion(string palabra){ Posicion *recorrido = primpos; while (true){ if (recorrido == NULL){ return false; } else if (recorrido->palabra == palabra){ return true; } recorrido = recorrido->siguiente; } } void InsteraPos(int linea,int posicion,string palabra){ if (primpos == NULL){ primpos = new Posicion (); primpos->palabra = palabra; primpos->linea.push_back(linea); primpos->posicion.push_back(posicion); return ; } else{ Posicion *recorrido = primpos; while (true){ if (recorrido->siguiente == NULL){ recorrido->siguiente = new Posicion (); recorrido->siguiente->palabra = palabra; recorrido->siguiente->posicion.push_back( posicion); recorrido->siguiente->linea.push_back(linea); return ; } recorrido = recorrido->siguiente; } } } void InsertaNuevaPos(string palabra,int linea,int posicion){ Posicion *recorrido = primpos; while (true){ if (recorrido->palabra == palabra){ recorrido->linea.push_back(linea); recorrido->posicion.push_back(posicion); return ; } recorrido = recorrido->siguiente; } } void DecidePos(string palabra,int linea, int posicion){ if (EnPosicion(palabra)){ InsertaNuevaPos(palabra,linea,posicion); } else{ InsteraPos(linea,posicion,palabra); } } void RetornaPosiciones(string palabra){ Posicion *recorrido = primpos; while (true){ if (recorrido->palabra == palabra){ for (int i = 0; i<recorrido->posicion.size() ; i++){ cout << "Encontrado en linea: " << recorrido->linea[i] << " en la posicion: " << recorrido->posicion[i] << endl; } break; } recorrido = recorrido->siguiente; } } void EliminaPos(){ if (primpos == NULL){ return; } else { Posicion *recorrido = primpos; Posicion *temp; while (true) { if (recorrido->siguiente == NULL) { free(recorrido); return; } else { temp = recorrido; recorrido = recorrido->siguiente; free(temp); } } } }
f35b94e55d979e3cab0be5cfc0c1ce8fc0bc17b6
7e21f6fd014dab6eddf144c85b8a21208db666fd
/readBook.cpp
95ca0d116911064c64829467c6abc045a58302b3
[]
no_license
thuang136/algorithm
167f0b6e638821a075709fc28d79ca5ba9190e15
5d8dbdd09dd494f267023d985288356e40a93c01
refs/heads/master
2016-09-06T03:51:48.505787
2015-06-28T07:58:57
2015-06-28T07:58:57
26,943,784
0
0
null
null
null
null
WINDOWS-1252
C++
false
false
1,866
cpp
readBook.cpp
/* Jessica is a girl who is loved by many boys. Jessica has an exam in a few days but hasn¡¯t started exam study yet. To pass the exam, she has to read and memorize a very thick book. Just like many others, the author of the book had repeated the same contents through many pages of the book. Jessica, realizing such a fact, wants to read each content more than once but to read the minimal pages of the book. Eventually she has decided to find the consecutively minimal parts so that she can read all the contents on the book. The boys who adore her have already found out contents on each page to help her exam study. Now, it is item to find the least section that she wants. At this moment, contents on each page are regarded as non-negative integers. For example, if there are contents of 1 8 8 2 8 8 1 in order on each page of the book, you need to read the first four pages of 1 8 8 2 or the last four pages of 2 8 8 1 that make you read the whole contents. When the numbers of the contents on each page of the book are given, find the minimal scope of the book to pass the exam in order to help out Jessica. Time limit: 10 second (java: 20 seconds) Input format Several test cases can be included in the inputs. T, the number of cases is given in the first row of the inputs. After that, the test cases as many as T (T ¡Ü 30) are given in a row. The number of the pages, N is given on the first row of each test case. (1 ¡Ü N ¡Ü 1000000) The contents repeated on each page are given by being separated with a blank on the second row. Output format Output a length of the minimal section including all contents on the first row of each test case. Example of Input 2 7 1 8 8 2 8 8 1 10 8 10 6 1 10 9 9 7 5 1 Example of Output 4 9 */ #include<cstdio> #include<iostream> using namespace std; int main(int argc, char** argv) { }
5953df1f19e6e2bf8f3b8bcbcf8567a1ed8009ed
0db8b24248e9957dcbc9cc13805e231c516bd3ce
/ArmedRobot/RectangularSolidShoot.cpp
d45080cbe8159dc46cbe5052988dca1cead034d2
[]
no_license
Kaito1539/ActionGame
6a72c5c03b04691b50bbb21760729f613b00a494
1da84ce7b6efd18f9d9fb447eb3c7a199d1ce1bc
refs/heads/master
2020-05-09T20:08:46.319063
2019-04-16T04:18:14
2019-04-16T04:18:14
181,329,564
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
2,260
cpp
RectangularSolidShoot.cpp
#include "RectangularSolidShoot.h" void RectangularSolidShoot::Initialize(int setMap[MAP_HEIGHT_MAX][MAP_WIDTH_MAX], int setMapH, int setMapW, int* setID){ x = y = width=height=0; atk = blowX =blowY = 0; alive = false; //GetGraphSize(graphic, &size[XA], &size[YA]); for (int i = 0; i < setMapH; i++){ for (int j = 0; j < setMapW; j++){ mapData[i][j] = setMap[i][j]; } } piID = setID; } void RectangularSolidShoot::Generate(int setAtk, int setStun, int setBlowX, int setBlowY, bool setStreak,int setHP, int setX, int setY, int setWidth, int setHeight, double setVX, double setVY, eDirection setDirection){ atk = setAtk; stun = setStun; blowX = setBlowX; blowY = setBlowY; streak = setStreak; x = setX; y = setY; width = setWidth; height = setHeight; vx = setVX; vy = setVY; hp = setHP; (*piID)++; if (*piID >= 1023){ *piID = 0; } iID = *piID; direction = setDirection; alive = true; } //終了 void RectangularSolidShoot::Finalize(){ alive = false; } //更新 void RectangularSolidShoot::Update(){ if (hp <= 0){ Finalize(); //return; } if (streak){ (*piID)++; if (*piID >= 1023){ *piID = 0; } iID = *piID; } //速度制限 if (vx > MAPCHIP_SIZE){ vx = MAPCHIP_SIZE; } else if (vx < -MAPCHIP_SIZE){ vx = -MAPCHIP_SIZE; } if (vy > MAPCHIP_SIZE){ vy = MAPCHIP_SIZE; } else if (vy < -MAPCHIP_SIZE){ vy = -MAPCHIP_SIZE; } postX = x + (int)vx; postY = y + (int)vy; MakeChecker(); CheckMap(); if (onX != eConnect_Free || onY != eConnect_Free){ hp = 0; } x = postX; y = postY; } //描画 void RectangularSolidShoot::Draw(int setStartScreenX, int setStartScreenY){ if (alive){ //DrawBox(x - setStartScreenX, y - setStartScreenY, x - setStartScreenX + width, y - setStartScreenY + height, GetColor(100, 200, 0), true); } if (alive){ if (direction == eDirection_Right){ DrawGraph(x - setStartScreenX, y - setStartScreenY, showImage, TRUE); } else{ DrawTurnGraph(x - setStartScreenX, y - setStartScreenY, showImage, TRUE); } } } int RectangularSolidShoot::GetHP(){ return hp; } void RectangularSolidShoot::SetImage(int setImage){ showImage = setImage; }
98d5daac42e4e4d68f88f434ce482698b3f56e8f
168c0dca487228f7682febfef1aaafe87e0006aa
/04/ex02/ISpaceMarine.hpp
63a28588af1299106146b24409670c8970744e4b
[]
no_license
yaksaer/42-CPP-Module
d22f50e35c8cac8d41ccee0691e3670719086ce8
e1faddb142ef00eb0aa54f1cff4d40b63f9f521e
refs/heads/master
2022-03-29T17:22:27.363929
2020-01-10T17:45:47
2020-01-10T17:45:47
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,208
hpp
ISpaceMarine.hpp
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ISpaceMarine.hpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: ncolomer <ncolomer@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/12/20 17:18:11 by ncolomer #+# #+# */ /* Updated: 2019/12/21 16:32:05 by ncolomer ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef ISPACEMARINE_HPP # define ISPACEMARINE_HPP # include <iostream> class ISpaceMarine { public: virtual ~ISpaceMarine() {} virtual ISpaceMarine *clone(void) const = 0; virtual void battleCry(void) const = 0; virtual void rangedAttack(void) const = 0; virtual void meleeAttack(void) const = 0; }; #endif
93dfb23221565bfeb20ad7ee128537a050d08499
91e386c08bfa45fb6161120bb243d9ff494477e7
/application/yut_project/yut_project.ino
db217c700361681ce7b0848d863db5f34a513b96
[ "MIT" ]
permissive
JUNGHOJONG/inner-circle
ccb03c6313b7240ff88a6d7ca9602e6ba5115feb
ac7b1487cd49bff885256e6f0d041b8761e84460
refs/heads/master
2023-07-19T04:31:08.223691
2021-08-29T16:19:52
2021-08-29T16:19:52
395,670,788
0
0
null
null
null
null
UTF-8
C++
false
false
5,464
ino
yut_project.ino
#include <Arduino.h> #include <Streaming.h> #include <Vector.h> #include <Wire.h> const long BAUD = 115200; // before -> 230400 const int ROOT_COUNT = 4; const int ROOT_LENGTH = 8; int root[ROOT_COUNT + 1][ROOT_LENGTH]; int currentPosition = 0; int movementCount = 0; // root 결정 변수 boolean zeroPin_rootCheck = false; boolean twoPin_rootCheck = false; boolean fourPin_rootCheck = false; int button = 14; int flag = 0; int count = 0; // 이번에 누른 카운 int excount = 1; // 방금 전까지 누적된 카운트 int isPlaying = 0; void(* resetFunc) (void) = 0; // reset 함수 선언 unsigned long beforeTime; unsigned long currentTime; int resetTime = 30 * 1000; // 30 void setup() { Serial.begin(BAUD); Wire.begin(); while (!Serial) { // wait for serial port to connect. } initRoot(); currentPosition = 8; // 원점 pinMode(button, INPUT_PULLUP); for (int i=0; i<=ROOT_LENGTH; i++) { pinMode(i + 2, OUTPUT); // 0 - 8 ==> 2 - 10 번 핀으로 변경 } } void initRoot() { for (int i=1; i<=ROOT_COUNT; i++) { for (int j=0; j<ROOT_LENGTH; j++) { root[i][j] = -1; } } root[1][0] = 8; root[1][1] = 5; root[1][2] = 2; root[1][3] = 1; root[1][4] = 0; root[1][5] = 3; root[1][6] = 6; root[1][7] = 7; root[2][0] = 8; root[2][1] = 5; root[2][2] = 2; root[2][3] = 4; root[3][0] = 8; root[3][1] = 5; root[3][2] = 2; root[3][3] = 1; root[3][4] = 0; root[3][5] = 4; root[4][0] = 8; root[4][1] = 5; root[4][2] = 2; root[4][3] = 4; root[4][4] = 6; root[4][5] = 7; } /** - 말이 원점으로 다시 오면 끝나는 것으로 간주한다. - 버튼 누를 때마다 말이 정확히 움직이는지 확 */ void loop() { currentTime = millis(); // 마스터가 슬레이브에게 데이터 달라고 요청 Wire.requestFrom(1, 1); // 슬레이브에서 전달받은 데이터 isPlaying = Wire.read(); // 마스터가 슬레이브에게 데이터 전달(시작) Wire.beginTransmission(1); int yutCount = 0; // 도, 개, 걸, 윷, 모 if (digitalRead(button) == 0 && isPlaying == 0) { // 음악이 재생 되는 동안에는 작동되면 안된다 if (flag == 0) { yutCount = throwYut(); printYutCount(yutCount); int rootNumber = getRootNumber(); // root 결정 currentPosition = movePosition(yutCount, rootNumber); updateRootCheck(); flag = 1; Serial.print("현재위치: "); Serial.println(currentPosition); // 윷 카운트 버퍼에 넣어 전달(마스터 -> 슬레이브) Wire.write(yutCount); // 마스터가 슬레이브에게 데이터 전달(끝) Wire.endTransmission(); beforeTime = currentTime; } } else { flag = 0; } // 현재 핀에 해당하는 LED에 불을킨다(0 - 8번 핀 사용한) turnOnLedOfCurrentPosition(); if (currentTime - beforeTime > resetTime) { // Wire.beginTransmission(1); // Wire.write(0); // Wire.endTransmission(); resetFunc(); // 아무 동작없이 30초가 지나면 리셋 } } int throwYut() { int yutCount = random(1, 101); if (yutCount >= 1 && yutCount <= 15) { return 1; // 도(15%) } else if (yutCount >= 16 && yutCount <= 50) { return 2; // 개(35%) } else if (yutCount >= 51 && yutCount <= 85) { return 3; // 걸(35%) } else if (yutCount >= 86 && yutCount <= 97) { return 4; // 윷(12%) } else { return 5; // 모(3%) } } void printYutCount(int yutCount) { if (yutCount == 1) { Serial.println("[도]"); } else if (yutCount == 2) { Serial.println("[개]"); } else if (yutCount == 3) { Serial.println("[걸]"); } else if (yutCount == 4) { Serial.println("[윷]"); } else { Serial.println("[모]"); } } int getRootNumber() { if (!zeroPin_rootCheck && twoPin_rootCheck && fourPin_rootCheck) { // 2 root return 2; } else if (!zeroPin_rootCheck && twoPin_rootCheck && !fourPin_rootCheck) { // 4 root return 4; } else if (!zeroPin_rootCheck && !twoPin_rootCheck && !fourPin_rootCheck) { // 1 root return 1; } else { // 3 root return 3; } } int movePosition(int yutCount, int rootNumber) { // 이동할 핀으로 이 // 해당 root 에서 해당 핀이 몇 번째 index인지 반환 int index = getIndexOfRoot(rootNumber); int currentRootLength = getCurrentRootLength(rootNumber); // 이동할 핀 최신화(index + yutCount) if (index + yutCount >= currentRootLength) { zeroPin_rootCheck = false; twoPin_rootCheck = false; fourPin_rootCheck = false; return 8; // 원점 반환, reset need } return root[rootNumber][index + yutCount]; } int getIndexOfRoot(int rootNumber) { for (int j=0; j<ROOT_LENGTH; j++) { if (root[rootNumber][j] == currentPosition) { return j; } } return -1; } int getCurrentRootLength(int rootNumber) { int count = 0; for (int j=0; j<ROOT_LENGTH; j++) { if (root[rootNumber][j] >= 0) { count++; } } return count; } void updateRootCheck() { if (currentPosition == 0) { zeroPin_rootCheck = true; } else if (currentPosition == 2) { twoPin_rootCheck = true; } else if (currentPosition == 4) { fourPin_rootCheck = true; } } void turnOnLedOfCurrentPosition() { for (int i=0; i<=ROOT_LENGTH; i++) { if (currentPosition == i) { digitalWrite(i + 2, HIGH); // 0 - 8 ==> 2 - 10 번 핀으로 변경 } else { digitalWrite(i + 2, LOW); } } }
f71ab5060e150ad09a105b51f9f29dc5cb91f62a
77df82e47d0df3f072501891ab416884de3bd885
/Player.h
beff156c23b1863273221435b4164a59ceb50dac
[]
no_license
Gleb8911/RaveGame
406d52e7dbab5d45f2a14cf274729e7f685d4b5a
c3e6ae3a20cc042b8406d57843ac97cd03c4c624
refs/heads/master
2022-11-07T09:30:40.297944
2020-06-30T20:51:44
2020-06-30T20:51:44
276,205,435
0
0
null
null
null
null
UTF-8
C++
false
false
1,631
h
Player.h
#pragma once #include "Components.h" #include "Actions.h" #include "ECS.h" #include "Inputs.h" #include "ChangeInputMediator.h" class Player { public: inline static Entity* CreatePlayer(Manager* manager, SDL_Renderer* renderer, ChangeInputMediator* mediator) { auto& player(manager->addEntity(pc)); player.title = "player"; IAction* action = new ActionPlayer(&player); SDL_Event* sdlEvent = new SDL_Event(); InputManager* inputManager = new InputManager(); player.tag = pc; player.addComponent<Health>(); player.addComponent<Transform>(); player.getComponent<Transform>().getVector()->set(250,250); player.getComponent<Transform>().setSpeed(2); player.addComponent<InputPlayer>(sdlEvent, inputManager, mediator); player.addComponent<RectCollider>(); player.getComponent<RectCollider>().instantiate(manager, action); player.getComponent<RectCollider>().setCollisionNorm(18, 60); player.addComponent<Texture>(); player.getComponent<Texture>().instatiate(renderer, "Assets/dancer.png", 100, 100, 8, 100); player.getComponent<Texture>().setSizeCords(0, 0); player.addComponent<InputTennis>(sdlEvent, inputManager, manager, renderer, mediator); player.getComponent<InputTennis>().hide = true; player.addComponent<InputShoot>(sdlEvent, inputManager, manager, renderer, mediator); player.getComponent<InputShoot>().hide = true; player.addComponent<InputPacMan>(sdlEvent,inputManager, mediator); player.getComponent<InputPacMan>().hide = true; player.getComponent<InputPacMan>().init(); player.isStatic = false; return &player; } };
71dbc54998d3dbeab780dbd64ddc7c926671bfcb
f8d26b4c36762cb3e1ce19899db70e960dbc88a3
/EziSocial_v2.4.1.2/Cocos2dx_2.2.x/ezibyte/ezisocial/include/EziFBIncomingRequest.h
e4d01105bfa7cae9cb950adc1b262edda267d844
[ "Zlib" ]
permissive
ezibyte/EziSocial-Plugin
db979d54a844801d92a0c340de5217b52948de96
9618103a4600239bc319dc0126e64c3fa1a6265a
refs/heads/master
2021-01-17T06:00:46.565638
2014-10-28T14:21:53
2014-10-28T14:21:53
9,576,982
2
1
null
null
null
null
UTF-8
C++
false
false
2,722
h
EziFBIncomingRequest.h
// // EziFBIncomingRequest.h // FacebookGameDemo // // Created by Paras Mendiratta on 20/05/13. // // #ifndef __FacebookGameDemo__EziFBIncomingRequest__ #define __FacebookGameDemo__EziFBIncomingRequest__ #include <iostream> #include "cocos2d.h" #include "EziSocialDefinition.h" #include "EziFacebookFriend.h" #define REQUEST_CONSUMED_STATUS_ "REQUEST_CONSUMED_STATUS_" USING_NS_CC; class EziFBIncomingRequest : public cocos2d::CCObject { EziFBIncomingRequest(); EziSocialWrapperNS::FB_REQUEST::TYPE _requestType; // Receiver's Facebook ID. This is important because if user change facebook login on device then he should not see other Facebook // user's request. std::string _receiverID; // This is gift dictionary or any other item dictionary. CCDictionary* _dataDictionary; // Friend who has sent the request. EziFacebookFriend* _sender; // Message came along with the request. std::string _message; // Facebook Request ID. std::string _requestID; // Call this when you have actually used this request in game. bool _consumed; // This is called if the data is already fetched from the server. // In case data is not fetched then you need to fetch the data first. bool _dataFetchedFromFacebook; void setData(std::string key, std::string data); public: // Static create methods static EziFBIncomingRequest* create(); static EziFBIncomingRequest* createForRequestID(std::string requestID); // Destructor virtual ~EziFBIncomingRequest(); // Setter void setReceiverID(std::string receiverID); void setMessage(std::string message); void setSender(std::string fbID, std::string username); void setSender(EziFacebookFriend* sender); void setRequestID(std::string requestID); void setDataDictionary(CCDictionary* dataDictionary); void setDataFetchedFromFacebook(bool dataFetched); void setConsumed(bool consumed); void setRequestType(EziSocialWrapperNS::FB_REQUEST::TYPE requestType); // Getter const char* getReceiverID(); const char* getRequestID(); const char* getMessage(); bool isConsumed(); bool isDataFetchedFromServer(); CCDictionary* getDataDictionary(); EziFacebookFriend* getSender(); EziSocialWrapperNS::FB_REQUEST::TYPE getRequestType(); // Save to persistant storage void saveToUserDefaults(); void purgeFromUserDefault(); // Useful to when you want to save the EziFBIncomingRequest Object in CCArray or CCDictionary. virtual CCObject* copyWithZone(CCZone *pZone); }; #endif /* defined(__FacebookGameDemo__EziFBIncomingRequest__) */
1af1e7c165881e102771a3647b3a875f3585bb17
ea4a1b9e369c879ff1cc254f0adb5f33649b284f
/final_project/Text_Game_Engine/Game.h
fa3d77c367533a76ebea4a689079765b863c2d7e
[]
no_license
jfacoustic/CSCI375_S2017_CMU
a6a1e010a8f9756cf7ec51d5a3579fcaf96815a0
0ca75f32c5f4f100b48b01891413168a36ceacbc
refs/heads/master
2021-01-11T15:52:59.621790
2017-05-09T02:30:04
2017-05-09T02:30:04
79,947,230
0
0
null
null
null
null
UTF-8
C++
false
false
394
h
Game.h
/* * Game.h * * Created on: May 1, 2017 * Author: joshua */ #ifndef GAME_H_ #define GAME_H_ #include <iostream> #include "Reader.h" #include "Controller.h" class Game { public: Game(Reader * reader, Controller * control); void run(); private: //std::string _textToPrint; bool _running; int _currentChoice; Reader * _reader; Controller * _control; }; #endif /* GAME_H_ */
0566a740f78045768a6557952bbf3e645936a65e
56a4cb943d085a672f8b0d08a8c047f772e6a45e
/code/Johnson_Engine/Runtime/render_a/src/sys/d3d/d3dmeshrendobj_rigid.cpp
ac2aa404b094a2f9930c061f44479390ada0de47
[]
no_license
robertveloso/suddenattack_legacy
2016fa21640d9a97227337ac8b2513af7b0ce00b
05ff49cced2ba651c25c18379fed156c58a577d7
refs/heads/master
2022-06-20T05:00:10.375695
2020-05-08T01:46:02
2020-05-08T01:46:02
262,199,345
3
1
null
null
null
null
UHC
C++
false
false
7,356
cpp
d3dmeshrendobj_rigid.cpp
// d3dmeshrendobj_rigid.cpp #include "precompile.h" #include "d3dmeshrendobj_rigid.h" #include "ltb.h" #include "d3d_device.h" #include "d3d_renderstatemgr.h" #include "render.h" //[MURSUM] 포커스 유무 확인 #include "ltvertexshadermgr.h" #include "ltpixelshadermgr.h" #include "d3d_renderstyle.h" #include "de_objects.h" #include "ltshaderdevicestateimp.h" //IClientShell game client shell object. #include "iclientshell.h" static IClientShell *i_client_shell; define_holder(IClientShell, i_client_shell); CD3DRigidMesh::CD3DRigidMesh() { Reset(); } CD3DRigidMesh::~CD3DRigidMesh() { FreeAll(); } void CD3DRigidMesh::CalcUsedNodes( Model *pModel ) { CreateUsedNodeList(1); m_pUsedNodeList[0] = m_iBoneEffector; } void CD3DRigidMesh::Reset() { m_VBController.Reset(); m_iVertCount = 0; m_iPolyCount = 0; m_pIndexData = NULL; for (uint32 i = 0; i < 4; ++i) m_pVertData[i] = NULL; } void CD3DRigidMesh::FreeAll() { m_VBController.FreeAll(); if (m_pIndexData) { delete[] m_pIndexData; m_pIndexData = NULL; } for (uint32 i = 0; i < 4; ++i) { if (m_pVertData[i]) { delete[] m_pVertData[i]; m_pVertData[i] = NULL; } } Reset(); } bool CD3DRigidMesh::Load(ILTStream& File, LTB_Header& LTBHeader) { if (LTBHeader.m_iFileType != LTB_D3D_MODEL_FILE) { OutputDebugString("Error: Wrong file type in CD3DSkelMesh::Load\n"); return false; } if (LTBHeader.m_iVersion != CD3D_LTB_LOAD_VERSION) { OutputDebugString("Error: Wrong file version in CD3DSkelMesh::Load\n"); return false; } // Read in the basics... uint32 iObjSize; File.Read(&iObjSize,sizeof(iObjSize)); File.Read(&m_iVertCount,sizeof(m_iVertCount)); File.Read(&m_iPolyCount,sizeof(m_iPolyCount)); uint32 iMaxBonesPerVert, iMaxBonesPerTri; File.Read(&iMaxBonesPerTri,sizeof(iMaxBonesPerTri)); assert(iMaxBonesPerTri == 1); File.Read(&iMaxBonesPerVert,sizeof(iMaxBonesPerVert)); assert(iMaxBonesPerVert == 1); File.Read(&m_VertStreamFlags[0],sizeof(uint32)*4); File.Read(&m_iBoneEffector,sizeof(m_iBoneEffector)); // Read in our Verts... for (uint32 i=0;i<4;++i) { if (!m_VertStreamFlags[i]) continue; uint32 iVertexSize = 0; // Figure out the vertex size... uint32 iVertFlags = 0; uint32 iUVSets = 0; GetVertexFlags_and_Size(eNO_WORLD_BLENDS,m_VertStreamFlags[i],iVertFlags,iVertexSize,iUVSets,m_bNonFixPipeData); uint32 iSize = iVertexSize * m_iVertCount; // Alloc the VertData... LT_MEM_TRACK_ALLOC(m_pVertData[i] = new uint8[iSize],LT_MEM_TYPE_RENDERER); File.Read(m_pVertData[i],iSize); } // Read in pIndexList... LT_MEM_TRACK_ALLOC(m_pIndexData = new uint8[sizeof(uint16) * m_iPolyCount * 3],LT_MEM_TYPE_RENDERER); File.Read(m_pIndexData,sizeof(uint16) * m_iPolyCount * 3); // Create the VBs and stuff... ReCreateObject(); return true; } // Create the VBs and stuff from our sys mem copies... void CD3DRigidMesh::ReCreateObject() { //[MURSUM] //포커스가 없을때는 스킵 if( false == g_Render.m_bInitted && false == g_Device.IsRestoreState() ) return; // Create our VB... for (uint32 i=0;i<4;++i) { if (!m_VertStreamFlags[i]) continue; if (!m_VBController.CreateStream(i,m_iVertCount,m_VertStreamFlags[i],eNO_WORLD_BLENDS,false,true,false)) { FreeAll(); return; } } if (!m_VBController.CreateIndexBuffer(m_iPolyCount*3,false,true,false)) { FreeAll(); return; } // Read in our Verts... for (i = 0; i < 4; ++i) { if (!m_VertStreamFlags[i]) continue; m_VBController.Lock((VertexBufferController::VB_TYPE)(VertexBufferController::eVERTSTREAM0 + i),false); uint8* pVertData = (uint8*)m_VBController.getVertexData(i); uint32 iSize = m_VBController.getVertexSize(i) * m_iVertCount; memcpy(pVertData,m_pVertData[i],iSize); m_VBController.UnLock((VertexBufferController::VB_TYPE)(VertexBufferController::eVERTSTREAM0 + i)); } // Read in pIndexList... m_VBController.Lock(VertexBufferController::eINDEX,false); memcpy(m_VBController.getIndexData(),m_pIndexData,sizeof(uint16) * m_iPolyCount * 3); m_VBController.UnLock(VertexBufferController::eINDEX); } // We're loosing focus, free the stuff... void CD3DRigidMesh::FreeDeviceObjects() { m_VBController.FreeAll(); // Free our VB... } // NOTE: The texture list needs to change to be device independent... void CD3DRigidMesh::Render(ModelInstance *pInstance, D3DMATRIX& WorldTransform,CD3DRenderStyle* pRenderStyle, uint32 iRenderPass) { //setup our transform for this model g_RenderStateMgr.SetTransform(D3DTS_WORLDMATRIX(0), &WorldTransform); // Set the vertex shader constants. if (m_pVertexShader != NULL) { // Let the client set some constants. if (NULL != i_client_shell) { i_client_shell->OnVertexShaderSetConstants(m_pVertexShader, iRenderPass, pRenderStyle, pInstance, LTShaderDeviceStateImp::GetSingleton()); } // Send the constants to the video card. LTVertexShaderMgr::GetSingleton().SetVertexShaderConstants(m_pVertexShader); } // Set the pixel shader constants. if (m_pPixelShader != NULL) { // Let the client set some constants. if (NULL != i_client_shell) { i_client_shell->OnPixelShaderSetConstants(m_pPixelShader, iRenderPass, pRenderStyle, pInstance, LTShaderDeviceStateImp::GetSingleton()); } // Send the constants to the video card. LTPixelShaderMgr::GetSingleton().SetPixelShaderConstants(m_pPixelShader); } //render away m_VBController.Render(0,0,m_iVertCount,m_iPolyCount); } void CD3DRigidMesh::BeginRender(CD3DRenderStyle* pRenderStyle, uint32 iRenderPass) { // If this pass has a vertex shader, use it. RSD3DRenderPass *pPass = pRenderStyle->GetRenderPass_D3DOptions(iRenderPass); if (NULL != pPass && pPass->bUseVertexShader && pPass->VertexShaderID != LTVertexShader::VERTEXSHADER_INVALID) { // Store the pointer to the actual shader during rendering. m_pVertexShader = LTVertexShaderMgr::GetSingleton().GetVertexShader(pPass->VertexShaderID); if (m_pVertexShader != NULL) { // Install the shader. if (!LTVertexShaderMgr::GetSingleton().InstallVertexShader(m_pVertexShader)) { m_pVertexShader = NULL; return; } } } else if (!m_VBController.getVertexFormat(0) || m_bNonFixPipeData) { // This is a non fixed function pipe VB - bail out... return; } else if (FAILED(g_RenderStateMgr.SetVertexShader(m_VBController.getVertexFormat(0)))) { return; } // If this pass has a pixel shader, use it. if (NULL != pPass && pPass->bUsePixelShader && pPass->PixelShaderID != LTPixelShader::PIXELSHADER_INVALID) { // Store the pointer to the actual shader during rendering. m_pPixelShader = LTPixelShaderMgr::GetSingleton().GetPixelShader(pPass->PixelShaderID); if (m_pPixelShader != NULL) { // Install the shader. if (!LTPixelShaderMgr::GetSingleton().InstallPixelShader(m_pPixelShader)) { m_pPixelShader = NULL; return; } } } m_VBController.SetStreamSources(); } void CD3DRigidMesh::EndRender() { PD3DDEVICE->SetStreamSource(0, 0, 0); PD3DDEVICE->SetIndices(0, 0); // Uninstall the vertex shader. if (NULL != m_pVertexShader) { LTVertexShaderMgr::GetSingleton().UninstallVertexShader(); m_pVertexShader = NULL; } // Uninstall the pixel shader. if (NULL != m_pPixelShader) { LTPixelShaderMgr::GetSingleton().UninstallPixelShader(); m_pPixelShader = NULL; } }
2d6345258bf18b6469532a3ceba67b27f980cbe0
30bdd8ab897e056f0fb2f9937dcf2f608c1fd06a
/DP/3356.cpp
0088914471e0b4ec1b63234b28866e8ec6c50a4a
[]
no_license
thegamer1907/Code_Analysis
0a2bb97a9fb5faf01d983c223d9715eb419b7519
48079e399321b585efc8a2c6a84c25e2e7a22a61
refs/heads/master
2020-05-27T01:20:55.921937
2019-11-20T11:15:11
2019-11-20T11:15:11
188,403,594
2
1
null
null
null
null
UTF-8
C++
false
false
814
cpp
3356.cpp
#include<bits/stdc++.h> #define ll long long #define pb push_back #define mp make_pair #define orz 1000000007 using namespace std; int n,z[1000005],b[1000005],k; char a[1000005]; void getz(){ int l=1,r=1; for(int i=2;i<=n;++i){ if(i>r){ l=i,r=i; while(r<=n&&a[r]==a[r-i+1])++r; z[i]=r-l,--r; } else{ int k=i-l+1; if(z[k]<r-i+1)z[i]=z[k]; else{ l=i; while(r<=n&&a[r]==a[r-i+1])++r; z[i]=r-l,--r; } } } } int main(){ char c=getchar(); while(c!='\n')a[++n]=c,c=getchar(); getz(); for(int i=2;i<=n;++i){ if(i+z[i]==n+1&&z[i]<=k){ for(int j=0;j<z[i];++j)putchar(a[i+j]); putchar('\n'); return 0; } k=max(k,z[i]); } puts("Just a legend"); return 0; }
0c4ef4f8821e4e3520123dc6123102bc4e043a3a
4dda21cfe5782394b2b249c6537df8e42757ccc0
/LT-535 Encode and Decode TinyURL.cpp
537f54eb334eac7ee598d75ce1b042bb73b00dd1
[]
no_license
yekesit/Leetcode-Problems
983d2b66d32fc8e0d58078a23d786ada32990177
d6fc7683ab7cd0b3c53cc2c932a4ea7731d370b2
refs/heads/master
2020-06-04T11:40:00.640517
2019-07-19T03:07:09
2019-07-19T03:07:09
192,006,515
0
0
null
null
null
null
UTF-8
C++
false
false
1,154
cpp
LT-535 Encode and Decode TinyURL.cpp
// // Created by Ke Ye on 2019-06-16. // #include <iostream> #include <random> #include <unordered_map> using namespace std; //Link in problem is how to save short URL //Here the problem is how to convert long URL to short URL class Solution { public: unordered_map<string, string> map; string alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; // Encodes a URL to a shortened URL. string encode(string longUrl) { srand(int(time(nullptr))); string key = ""; for(int i = 0; i < 6; i++){ int index = rand() % 62; key += to_string(alphabet[index]); } if(map.find(key) == map.end()){ map[key] = longUrl; } return "http://tinyurl.com/" + key; } // Decodes a shortened URL to its original URL. string decode(string shortUrl) { int key_index = shortUrl.find_last_of('/'); string key = shortUrl.substr(key_index + 1); return map[key]; } }; // Your Solution object will be instantiated and called as such: // Solution solution; // solution.decode(solution.encode(url)); int main(){ }
501dc5f8bf72ac075e40a34852bf80c32fd7826c
d754aa8080c6524a1a12b9b82ce68aa8a492606e
/raft/msg_ids_test.cc
90d5b02f4d34f181e8782e586c6759112f0e7195
[ "Apache-2.0" ]
permissive
szab100/sfdb
28a2d45c950b5d59a74af3e2af28acdf05ce2dff
02d8d8412d944019830f4b2a642bcbf223fc356a
refs/heads/master
2023-01-09T14:52:58.386665
2021-05-25T18:12:37
2021-05-25T18:12:37
248,836,038
6
2
Apache-2.0
2023-01-07T16:10:26
2020-03-20T19:28:14
C++
UTF-8
C++
false
false
2,134
cc
msg_ids_test.cc
/* * Copyright (c) 2019 Google LLC. * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ #include "raft/msg_ids.h" #include <memory> #include <set> #include <vector> #include "absl/memory/memory.h" #include "gtest/gtest.h" #include "util/thread/concurrent_queue.h" #include "util/thread/thread.h" #include "util/types/integral_types.h" namespace raft { using ::absl::make_unique; using util::thread::Options; const int kNumThreads = 4; const int kIdsPerThread = 40000; uint64 ids[kNumThreads][kIdsPerThread]; Options Opts() { Options opts; opts.set_joinable(true); return opts; } // Generates kIdsPerThread IDs and appends them to *out. class T : public Thread { public: T(MsgIds *gen, uint64 *out) : Thread(Opts(), "T"), gen_(gen), out_(out) { Start(); } void Run() override { for (int i = 0; i < kIdsPerThread; ++i) out_[i] = gen_->Make(); } private: MsgIds *gen_; uint64 *out_; }; TEST(MsgIdsTest, Uniqueness) { MsgIds gen(5, 2); std::vector<std::unique_ptr<T>> threads; for (int i = 0; i < kNumThreads; ++i) threads.emplace_back(make_unique<T>(&gen, ids[i])); for (int i = 0; i < kNumThreads; ++i) threads[i]->Join(); std::set<uint64> all_ids; for (int i = 0; i < kNumThreads; ++i) all_ids.insert(ids[i], ids[i] + kIdsPerThread); ASSERT_EQ(kNumThreads * kIdsPerThread, all_ids.size()); } } // namespace raft
73610fe6e0eb75c26902338bf08135cd4b003baa
f6f0be9108ba516d0f49e009ffe525814c6f0c95
/test/miscellaneous/scheduling_jobs_test.cpp
0c4934dc0b882222615ed26bf1d416d3f7f5c1c4
[]
no_license
PauloMiranda98/Competitive-Programming-Notebook
fe07a318c50c147cc3939dfde9034fe3de5056d9
54af0a8dcefdeb5505538a3716855db62bcdc716
refs/heads/master
2023-08-02T04:36:52.830218
2023-07-31T00:21:04
2023-07-31T00:21:04
242,273,238
20
4
null
2021-07-08T19:21:44
2020-02-22T03:30:13
C++
UTF-8
C++
false
false
1,139
cpp
scheduling_jobs_test.cpp
#include "../../code/miscellaneous/scheduling_jobs.h" ll penalty1(vector<Job> v){ ll ans = 0; ll T=0; for(Job j: v){ ans += j.c*(ll)T; T += j.t; } return ans; } long double penalty2(vector<Job> v){ long double ans = 0; ll T=0; for(Job j: v){ ans += j.c*exp(alfa*T); T += j.t; } return ans; } void testCmp1(){ srand(2020); vector<Job> v; for(int i=0; i<9; i++){ Job j; j.t = (rand()%1000) + 1; j.c = (rand()%1000) + 1; v.emplace_back(j); } sort(v.begin(), v.end(), cmp1); ll ans = penalty1(v); ll mnAns = ans; do{ mnAns = min(mnAns, penalty1(v)); }while(next_permutation(v.begin(), v.end(), cmp1)); assert(ans == mnAns); } void testCmp2(){ srand(2020); vector<Job> v; for(int i=0; i<8; i++){ Job j; j.t = (rand()%2) + 1; j.c = (rand()%1000) + 1; v.emplace_back(j); } sort(v.begin(), v.end(), cmp2); long double ans = penalty1(v); long double mnAns = ans; do{ mnAns = min(mnAns, penalty2(v)); }while(next_permutation(v.begin(), v.end(), cmp1)); assert(abs(ans-mnAns) < EPS); } int main(){ testCmp1(); testCmp2(); return 0; }
1557d2a28855d94f081651bb5c18ff31ada2d2f1
77be3ab5c3cee0fa2c27c7bac1da0c80f45e5761
/Re-arrangArray4.cpp
11e94f245286959206f50eed141d0445b6f97bf3
[]
no_license
diepdao1708/zcode
50351c96c150b1628f58207df36b65891ae49ab8
a20e52469d84d9e4e337f0568d3e8cc47279a5fd
refs/heads/main
2023-04-24T10:29:11.317410
2021-05-06T14:17:12
2021-05-06T14:17:12
364,934,518
1
0
null
null
null
null
UTF-8
C++
false
false
426
cpp
Re-arrangArray4.cpp
#include<bits/stdc++.h> using namespace std; int n; vector<int> a; void Run() { a.clear(); cin>>n; a.resize(n); for(int i=0; i<n; i++) cin>>a[i]; sort(a.begin(), a.end()); int k=n-n/2; int m=k; for(int i=0; i<m; i++) { cout<<a[i]<<' '; if(k!=n) cout<<a[k]<<' '; k++; } cout<<'\n'; } int main() { int T=1; cin>>T; while(T--) Run(); return 0; }