$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% $ == cpp.cin == cin >> ; $ == cpp.cout-variabe == cout << << endl; $ == cpp.cout-string == cout << "\n"; $ == cpp.cout-operator == insert == << "" $ $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% == cpp.output-manipulator-boolalpha == insert == << boolalpha == cpp.output-manipulator-dec == insert == << dec == cpp.output-manipulator-endl == insert == << endl == cpp.output-manipulator-fixed == insert == << fixed == cpp.output-manipulator-flush == insert == << flush == cpp.output-manipulator-hex == insert == << hex == cpp.output-manipulator-internal == insert == << internal == cpp.output-manipulator-left == insert == << left == cpp.output-manipulator-oct == insert == << oct == cpp.output-manipulator-right == insert == << right == cpp.output-manipulator-scientific == insert == << scientific == cpp.output-manipulator-setbase == insert == << setbase(10) == cpp.output-manipulator-setfill == insert == << setfill() == cpp.output-manipulator-setiosflag == insert == << setiosflags() == cpp.output-manipulator-setprecision == insert == << setprecision(6) == cpp.output-manipulator-setw == insert == << setw(0) == cpp.output-manipulator-showbase == insert == << showbase == cpp.output-manipulator-showpoint == insert == << showpoint == cpp.output-manipulator-showpos == insert == << showpos == cpp.output-manipulator-uppercase == insert == << uppercase $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% == cpp.method-implementation == //-------------------------------------------------------------------------------------- // Class: |?CLASSNAME| // Method: |?METHODNAME| //-------------------------------------------------------------------------------------- void |CLASSNAME|::|METHODNAME| ( ) { return ; } // ----- end of method |CLASSNAME|::|METHODNAME| ----- $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% == cpp.accessor-implementation == /** * Class: |?CLASSNAME| * Method: Get|?ATTRIBUTE| */ inline int |CLASSNAME|::Get|ATTRIBUTE| ( ) { return |ATTRIBUTE|; } // ----- end of method |CLASSNAME|::get_|ATTRIBUTE| ----- //-------------------------------------------------------------------------------------- // Class: |CLASSNAME| // Method: set_|ATTRIBUTE| //-------------------------------------------------------------------------------------- inline void |CLASSNAME|::Set|ATTRIBUTE| ( int value ) { |ATTRIBUTE| = value; return ; } // ----- end of method |CLASSNAME|::set_|ATTRIBUTE| ----- $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% == cpp.class-definition == /** \brief \details */ class |?CLASSNAME:c| : public |?BASECLASS:c| { // ==================== LIFECYCLE ======================= /** Default constructor */ |CLASSNAME| ( ); /** Default destructor */ ~|CLASSNAME| (); // ==================== OPERATORS ======================= // ==================== OPERATIONS ======================= // ==================== ACCESS ======================= // ==================== INQUIRY ======================= protected: // ==================== DATA MEMBERS ========================= private: }; // ----- end of class |CLASSNAME| ----- $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% == cpp.class-definitionLemma == #pragma once #include "|?BASECLASS|.h" namespace Lemma { /** * \ingroup |?MODULE| * \brief * \details */ class |?CLASSNAME:c| : public |BASECLASS:c| { friend std::ostream &operator<<(std::ostream &stream, const |CLASSNAME| &ob); protected: /* * This key is used to lock the constructor. It is protected so that inhereted * classes also have the key to contruct their base class. */ struct ctor_key {}; public: // ==================== LIFECYCLE ======================= /** * Default constructor. * @note This method is locked, and cannot be called directly. * The reason that the method is public is to enable the use * of make_shared whilst enforcing the use of shared_ptr, * in c++-17, this curiosity may be resolved. * @see |CLASSNAME|::NewSP */ explicit |CLASSNAME| ( const ctor_key& ); /** * DeSerializing constructor. * @note This method is locked, and cannot be called directly. * The reason that the method is public is to enable the use * of make_shared whilst enforcing the use of shared_ptr, * in c++-17, this curiosity may be resolved. * @see |CLASSNAME|::DeSerialize */ |CLASSNAME| ( const YAML::Node& node, const ctor_key& ); /** * Default destructor. * @note This method should never be called due to the mandated * use of smart pointers. It is necessary to keep the method * public in order to allow for the use of the more efficient * make_shared constructor. */ virtual ~|CLASSNAME| (); /** * Uses YAML to serialize this object. * @return a YAML::Node * @see |CLASSNAME|::DeSerialize */ virtual YAML::Node Serialize() const; /* * Factory method for generating concrete class. * @return a std::shared_ptr of type |CLASSNAME| */ static std::shared_ptr< |CLASSNAME| > NewSP(); /** * Constructs an |CLASSNAME| object from a YAML::Node. * @see |CLASSNAME|::Serialize */ static std::shared_ptr<|CLASSNAME|> DeSerialize(const YAML::Node& node); // ==================== OPERATORS ======================= // ==================== OPERATIONS ======================= // ==================== ACCESS ======================= // ==================== INQUIRY ======================= /** * Returns the name of the underlying class, similiar to Python's type * @return string of class name */ virtual inline std::string GetName() const { return CName; } protected: // ==================== LIFECYCLE ======================= /** Copy is disabled */ |CLASSNAME|( const |CLASSNAME|& ) = delete; // ==================== DATA MEMBERS ========================= private: /** ASCII string representation of the class name */ static constexpr auto CName = "|CLASSNAME|"; }; // ----- end of class |CLASSNAME| ----- } // ----- end of namespace Lemma ---- /* vim: set tabstop=4 expandtab: */ /* vim: set filetype=cpp: */ $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% == cpp.class-definitionLemmaAbstract == /** \brief \details */ class |?CLASSNAME:c| : public |?BASECLASS:c| { friend std::ostream &operator<<(std::ostream &stream, const |CLASSNAME| &ob) { stream << *(|BASECLASS|*)(&ob); return stream; } public: // ==================== LIFECYCLE ======================= // ==================== OPERATORS ======================= // ==================== OPERATIONS ======================= virtual void APIDemo()=0; // REMEMBER TO MAKE PURE VIRTUAL DUMMY // ==================== ACCESS ======================= // ==================== INQUIRY ======================= protected: // ==================== LIFECYCLE ======================= /** Default protected constructor, abstract class this cannot be called */ |CLASSNAME| (const std::string& name); /** Default protected destructor, this is an abstract class, this cannot be called */ ~|CLASSNAME| (); // ==================== DATA MEMBERS ========================= private: }; // ----- end of class |CLASSNAME| ----- $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% == cpp.class-implementationLemma == #include "|?CLASSNAME|.h" namespace Lemma { // ==================== FRIEND METHODS ===================== std::ostream &operator << (std::ostream &stream, const |CLASSNAME| &ob) { stream << ob.Serialize() << "\n---\n"; // End of doc --- return stream; } // ==================== LIFECYCLE ======================= //-------------------------------------------------------------------------------------- // Class: |CLASSNAME| // Method: |CLASSNAME| // Description: constructor (locked) //-------------------------------------------------------------------------------------- |CLASSNAME|::|CLASSNAME| (const ctor_key&) : |?BASECLASS|( |BASECLASS|::ctor_key() ) { } // ----- end of method |CLASSNAME|::|CLASSNAME| (constructor) ----- //-------------------------------------------------------------------------------------- // Class: |CLASSNAME| // Method: |CLASSNAME| // Description: DeSerializing constructor (locked) //-------------------------------------------------------------------------------------- |CLASSNAME|::|CLASSNAME| (const YAML::Node& node, const ctor_key&) : |BASECLASS|(node, |BASECLASS|::ctor_key()) { } // ----- end of method |CLASSNAME|::|CLASSNAME| (constructor) ----- //-------------------------------------------------------------------------------------- // Class: |CLASSNAME| // Method: NewSP() // Description: public constructor returing a shared_ptr //-------------------------------------------------------------------------------------- std::shared_ptr< |CLASSNAME| > |CLASSNAME|::NewSP() { return std::make_shared< |CLASSNAME| >( ctor_key() ); } //-------------------------------------------------------------------------------------- // Class: |CLASSNAME| // Method: ~|CLASSNAME| // Description: destructor (protected) //-------------------------------------------------------------------------------------- |CLASSNAME|::~|CLASSNAME| () { } // ----- end of method |CLASSNAME|::~|CLASSNAME| (destructor) ----- //-------------------------------------------------------------------------------------- // Class: |CLASSNAME| // Method: Serialize //-------------------------------------------------------------------------------------- YAML::Node |CLASSNAME|::Serialize ( ) const { YAML::Node node = |BASECLASS|::Serialize(); node.SetTag( GetName() ); // FILL IN CLASS SPECIFICS HERE return node; } // ----- end of method |CLASSNAME|::Serialize ----- //-------------------------------------------------------------------------------------- // Class: |CLASSNAME| // Method: DeSerialize //-------------------------------------------------------------------------------------- std::shared_ptr<|CLASSNAME|> |CLASSNAME|::DeSerialize ( const YAML::Node& node ) { if (node.Tag() != "|CLASSNAME|" ) { throw DeSerializeTypeMismatch( "|CLASSNAME|", node.Tag()); } return std::make_shared< |CLASSNAME| > ( node, ctor_key() ); } // ----- end of method |CLASSNAME|::DeSerialize ----- } // ---- end of namespace Lemma ---- /* vim: set tabstop=4 expandtab: */ /* vim: set filetype=cpp: */ $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% == cpp.class-implementation == // ==================== LIFECYCLE ======================= //-------------------------------------------------------------------------------------- // Class: |CLASSNAME| // Method: |CLASSNAME| // Description: constructor (protected) //-------------------------------------------------------------------------------------- |CLASSNAME|::|CLASSNAME| ( ) : |BASECLASS|(name) { } // ----- end of method |CLASSNAME|::|CLASSNAME| (constructor) ----- //-------------------------------------------------------------------------------------- // Class: |CLASSNAME| // Method: ~|CLASSNAME| // Description: destructor //-------------------------------------------------------------------------------------- |CLASSNAME|::~|CLASSNAME| () { } // ----- end of method |CLASSNAME|::~|CLASSNAME| (destructor) ----- $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% == cpp.class-using-new-definition == // ===================================================================================== // Class: |?CLASSNAME:c| // Description: // ===================================================================================== class |CLASSNAME| { public: // ==================== LIFECYCLE ======================================= |CLASSNAME| (); // constructor |CLASSNAME| ( const |CLASSNAME| &other ); // copy constructor ~|CLASSNAME| (); // destructor // ==================== OPERATORS ======================================= const |CLASSNAME|& operator = ( const |CLASSNAME| &other ); // assignment operator // ==================== OPERATIONS ======================================= // ==================== ACCESS ======================================= // ==================== INQUIRY ======================================= // ==================== DATA MEMBERS ======================================= protected: private: }; // ----- end of class |CLASSNAME| ----- $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% == cpp.class-using-new-implementation == //-------------------------------------------------------------------------------------- // Class: |?CLASSNAME| // Method: |CLASSNAME| // Description: constructor //-------------------------------------------------------------------------------------- |CLASSNAME|::|CLASSNAME| () { } // ----- end of method |CLASSNAME|::|CLASSNAME| (constructor) ----- //-------------------------------------------------------------------------------------- // Class: |CLASSNAME| // Method: |CLASSNAME| // Description: copy constructor //-------------------------------------------------------------------------------------- |CLASSNAME|::|CLASSNAME| ( const |CLASSNAME| &other ) { } // ----- end of method |CLASSNAME|::|CLASSNAME| (copy constructor) ----- //-------------------------------------------------------------------------------------- // Class: |CLASSNAME| // Method: ~|CLASSNAME| // Description: destructor //-------------------------------------------------------------------------------------- |CLASSNAME|::~|CLASSNAME| () { } // ----- end of method |CLASSNAME|::~|CLASSNAME| (destructor) ----- //-------------------------------------------------------------------------------------- // Class: |CLASSNAME| // Method: operator = // Description: assignment operator //-------------------------------------------------------------------------------------- const |CLASSNAME|& |CLASSNAME|::operator = ( const |CLASSNAME| &other ) { if ( this != &other ) { } return *this; } // ----- end of method |CLASSNAME|::operator = (assignment operator) ----- $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% == cpp.error-class == // ===================================================================================== // Class: |?CLASSNAME:c| // Description: // ===================================================================================== class |CLASSNAME| { public: |CLASSNAME| ( string msg = "|CLASSNAME|" ):message(msg) { } virtual ~|CLASSNAME| ( ) { } virtual string what ( ) const throw ( ) { return message; } protected: string message; }; // ---------- end of class |CLASSNAME| ---------- $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% == cpp.template-method-implementation == template < class T > void |?CLASSNAME|::|?METHODNAME| ( ) { return ; } // ----- end of method |CLASSNAME|::|METHODNAME| ----- $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% == cpp.template-accessor-implementation == //-------------------------------------------------------------------------------------- // Class: |?CLASSNAME| // Method: get_|?ATTRIBUTE| //-------------------------------------------------------------------------------------- template < class T > inline int |CLASSNAME|::get_|ATTRIBUTE| ( ) { return |ATTRIBUTE|; } // ----- end of method |CLASSNAME|::get_|ATTRIBUTE| ----- //-------------------------------------------------------------------------------------- // Class: |CLASSNAME| // Method: set_|ATTRIBUTE| //-------------------------------------------------------------------------------------- template < class T > inline void |CLASSNAME|::set_|ATTRIBUTE| ( int value ) { |ATTRIBUTE| = value; return ; } // ----- end of method |CLASSNAME|::set_|ATTRIBUTE| ----- $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% == cpp.template-class-definition == // ===================================================================================== // Class: |?CLASSNAME:c| // Description: // ===================================================================================== template < class T > class |CLASSNAME| { public: // ==================== LIFECYCLE ======================================= |CLASSNAME| (); // constructor // ==================== OPERATORS ======================================= // ==================== OPERATIONS ======================================= // ==================== ACCESS ======================================= // ==================== INQUIRY ======================================= // ==================== DATA MEMBERS ======================================= protected: private: }; // ----- end of template class |CLASSNAME| ----- $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% == cpp.template-class-implementation == //-------------------------------------------------------------------------------------- // Class: |?CLASSNAME| // Method: |CLASSNAME| // Description: constructor //-------------------------------------------------------------------------------------- template < class T > |CLASSNAME| :: |CLASSNAME| () { } // ----- end of constructor of template class |CLASSNAME| ----- $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% == cpp.template-class-using-new-definition == // ===================================================================================== // Class: |?CLASSNAME:c| // Description: // ===================================================================================== template < class T > class |CLASSNAME| { public: // ==================== LIFECYCLE ======================================= |CLASSNAME| (); // constructor |CLASSNAME| ( const |CLASSNAME| &other ); // copy constructor ~|CLASSNAME| (); // destructor // ==================== OPERATORS ======================================= const |CLASSNAME|& operator = ( const |CLASSNAME| &other ); // assignment operator // ==================== OPERATIONS ======================================= // ==================== ACCESS ======================================= // ==================== INQUIRY ======================================= // ==================== DATA MEMBERS ======================================= protected: private: }; // ----- end of template class |CLASSNAME| ----- $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% == cpp.template-class-using-new-implementation == //-------------------------------------------------------------------------------------- // Class: |?CLASSNAME| // Method: |CLASSNAME| // Description: constructor //-------------------------------------------------------------------------------------- template < class T > |CLASSNAME|::|CLASSNAME| () { } // ----- end of constructor of template class |CLASSNAME| ----- //-------------------------------------------------------------------------------------- // Class: |CLASSNAME| // Method: |CLASSNAME| // Description: copy constructor //-------------------------------------------------------------------------------------- template < class T > |CLASSNAME|::|CLASSNAME| ( const |CLASSNAME| &other ) { } // ----- end of copy constructor of template class |CLASSNAME| ----- //-------------------------------------------------------------------------------------- // Class: |CLASSNAME| // Method: ~|CLASSNAME| // Description: destructor //-------------------------------------------------------------------------------------- template < class T > |CLASSNAME|::~|CLASSNAME| () { } // ----- end of destructor of template class |CLASSNAME| ----- //-------------------------------------------------------------------------------------- // Class: |CLASSNAME| // Method: operator = // Description: assignment operator //-------------------------------------------------------------------------------------- template < class T > const |CLASSNAME|& |CLASSNAME|::operator = ( const |CLASSNAME| &other ) { if ( this != &other ) { } return *this; } // ----- end of assignment operator of template class |CLASSNAME| ----- $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% == cpp.template-function == template void |?TEMPALTE_FUNCTION_NAME| ( T param ) { return ; } // ----- end of template function |?TEMPALTE_FUNCTION_NAME| ----- $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% == cpp.operator-in == ostream & operator << ( ostream & os, const |?CLASSNAME| & obj ) { os << obj. ; return os; } // ----- end of function operator << ----- $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% == cpp.operator-out == istream & operator >> ( istream & is, |?CLASSNAME| & obj ) { is >> obj. ; return is; } // ----- end of function operator >> ----- $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% == cpp.try-catch == try { } catch ( const &ExceptObj ) { // handle exception: } catch (...) { // handle exception: unspezified } $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% == cpp.catch == catch ( const &ExceptObj ) { // handle exception: } $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% == cpp.catch-points == catch (...) { // handle exception: } $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% == cpp.extern == extern "C" { } $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% == cpp.open-input-file == string ifs_file_name = ""; // input file name ifstream ifs; // create ifstream object ifs.open ( ifs_file_name.c_str() ); // open ifstream if (!ifs) { cerr << "\nERROR : failed to open input file " << ifs_file_name << endl; exit (EXIT_FAILURE); } ifs.close (); // close ifstream $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% == cpp.open-output-file == string ofs_file_name = ""; // input file name ofstream ofs; // create ofstream object ofs.open ( ofs_file_name.c_str() ); // open ofstream if (!ofs) { cerr << "\nERROR : failed to open output file " << ofs_file_name << endl; exit (EXIT_FAILURE); } ofs.close (); // close ofstream $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% == cpp.namespace-std == using namespace std; == cpp.namespace == using namespace |?NAMESPACE|; == cpp.namespace-block == namespace |?NAMESPACE| { } // ----- end of |NAMESPACE| name ----- $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% == cpp.rtti-typeid == insert == typeid() $ == cpp.rtti-static-cast == insert == static_cast<>() $ == cpp.rtti-const-cast == insert == const_cast<>() $ == cpp.rtti-reinterpret-cast == insert == reinterpret_cast<>() $ == cpp.rtti-dynamic-cast == insert == dynamic_cast<>() $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /* vim: set tabstop=4 expandtab: */ /* vim: set filetype=cpp: */