Lemma is an Electromagnetics API
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

lemma.cpp.template 25KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706
  1. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2. $
  3. == cpp.cin ==
  4. cin >> <CURSOR>;
  5. $
  6. == cpp.cout-variabe ==
  7. cout << <CURSOR> << endl;
  8. $
  9. == cpp.cout-string ==
  10. cout << "<CURSOR>\n";
  11. $
  12. == cpp.cout-operator == insert ==
  13. << "<CURSOR>"
  14. $
  15. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  16. == cpp.output-manipulator-boolalpha == insert ==
  17. << boolalpha <CURSOR>
  18. == cpp.output-manipulator-dec == insert ==
  19. << dec <CURSOR>
  20. == cpp.output-manipulator-endl == insert ==
  21. << endl <CURSOR>
  22. == cpp.output-manipulator-fixed == insert ==
  23. << fixed <CURSOR>
  24. == cpp.output-manipulator-flush == insert ==
  25. << flush <CURSOR>
  26. == cpp.output-manipulator-hex == insert ==
  27. << hex <CURSOR>
  28. == cpp.output-manipulator-internal == insert ==
  29. << internal <CURSOR>
  30. == cpp.output-manipulator-left == insert ==
  31. << left <CURSOR>
  32. == cpp.output-manipulator-oct == insert ==
  33. << oct <CURSOR>
  34. == cpp.output-manipulator-right == insert ==
  35. << right <CURSOR>
  36. == cpp.output-manipulator-scientific == insert ==
  37. << scientific <CURSOR>
  38. == cpp.output-manipulator-setbase == insert ==
  39. << setbase(10<CURSOR>)
  40. == cpp.output-manipulator-setfill == insert ==
  41. << setfill(<CURSOR>)
  42. == cpp.output-manipulator-setiosflag == insert ==
  43. << setiosflags(<CURSOR>)
  44. == cpp.output-manipulator-setprecision == insert ==
  45. << setprecision(6<CURSOR>)
  46. == cpp.output-manipulator-setw == insert ==
  47. << setw(0<CURSOR>)
  48. == cpp.output-manipulator-showbase == insert ==
  49. << showbase <CURSOR>
  50. == cpp.output-manipulator-showpoint == insert ==
  51. << showpoint <CURSOR>
  52. == cpp.output-manipulator-showpos == insert ==
  53. << showpos <CURSOR>
  54. == cpp.output-manipulator-uppercase == insert ==
  55. << uppercase <CURSOR>
  56. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  57. == cpp.method-implementation ==
  58. //--------------------------------------------------------------------------------------
  59. // Class: |?CLASSNAME|
  60. // Method: |?METHODNAME|
  61. //--------------------------------------------------------------------------------------
  62. <CURSOR>void |CLASSNAME|::|METHODNAME| ( ) {
  63. return ;
  64. } // ----- end of method |CLASSNAME|::|METHODNAME| -----
  65. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  66. == cpp.accessor-implementation ==
  67. /**
  68. * Class: |?CLASSNAME|
  69. * Method: Get|?ATTRIBUTE|
  70. */
  71. inline <CURSOR>int |CLASSNAME|::Get|ATTRIBUTE| ( ) {
  72. return |ATTRIBUTE|;
  73. } // ----- end of method |CLASSNAME|::get_|ATTRIBUTE| -----
  74. //--------------------------------------------------------------------------------------
  75. // Class: |CLASSNAME|
  76. // Method: set_|ATTRIBUTE|
  77. //--------------------------------------------------------------------------------------
  78. inline void |CLASSNAME|::Set|ATTRIBUTE| ( int value ) {
  79. |ATTRIBUTE| = value;
  80. return ;
  81. } // ----- end of method |CLASSNAME|::set_|ATTRIBUTE| -----
  82. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  83. == cpp.class-definition ==
  84. /**
  85. \brief <CURSOR>
  86. \details
  87. */
  88. class |?CLASSNAME:c| : public |?BASECLASS:c| {
  89. // ==================== LIFECYCLE =======================
  90. /** Default constructor */
  91. |CLASSNAME| ( );
  92. /** Default destructor */
  93. ~|CLASSNAME| ();
  94. // ==================== OPERATORS =======================
  95. // ==================== OPERATIONS =======================
  96. // ==================== ACCESS =======================
  97. // ==================== INQUIRY =======================
  98. protected:
  99. // ==================== DATA MEMBERS =========================
  100. private:
  101. }; // ----- end of class |CLASSNAME| -----
  102. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  103. == cpp.class-definitionLemma ==
  104. #pragma once
  105. #include "|?BASECLASS|.h"
  106. namespace Lemma {
  107. /**
  108. * \ingroup |?MODULE|
  109. * \brief <CURSOR>
  110. * \details
  111. */
  112. class |?CLASSNAME:c| : public |BASECLASS:c| {
  113. friend std::ostream &operator<<(std::ostream &stream, const |CLASSNAME| &ob);
  114. protected:
  115. /*
  116. * This key is used to lock the constructor. It is protected so that inhereted
  117. * classes also have the key to contruct their base class.
  118. */
  119. struct ctor_key {};
  120. public:
  121. // ==================== LIFECYCLE =======================
  122. /**
  123. * Default constructor.
  124. * @note This method is locked, and cannot be called directly.
  125. * The reason that the method is public is to enable the use
  126. * of make_shared whilst enforcing the use of shared_ptr,
  127. * in c++-17, this curiosity may be resolved.
  128. * @see |CLASSNAME|::NewSP
  129. */
  130. explicit |CLASSNAME| ( const ctor_key& );
  131. /**
  132. * DeSerializing constructor.
  133. * @note This method is locked, and cannot be called directly.
  134. * The reason that the method is public is to enable the use
  135. * of make_shared whilst enforcing the use of shared_ptr,
  136. * in c++-17, this curiosity may be resolved.
  137. * @see |CLASSNAME|::DeSerialize
  138. */
  139. |CLASSNAME| ( const YAML::Node& node, const ctor_key& );
  140. /**
  141. * Default destructor.
  142. * @note This method should never be called due to the mandated
  143. * use of smart pointers. It is necessary to keep the method
  144. * public in order to allow for the use of the more efficient
  145. * make_shared constructor.
  146. */
  147. virtual ~|CLASSNAME| ();
  148. /**
  149. * Uses YAML to serialize this object.
  150. * @return a YAML::Node
  151. * @see |CLASSNAME|::DeSerialize
  152. */
  153. virtual YAML::Node Serialize() const;
  154. /*
  155. * Factory method for generating concrete class.
  156. * @return a std::shared_ptr of type |CLASSNAME|
  157. */
  158. static std::shared_ptr< |CLASSNAME| > NewSP();
  159. /**
  160. * Constructs an |CLASSNAME| object from a YAML::Node.
  161. * @see |CLASSNAME|::Serialize
  162. */
  163. static std::shared_ptr<|CLASSNAME|> DeSerialize(const YAML::Node& node);
  164. // ==================== OPERATORS =======================
  165. // ==================== OPERATIONS =======================
  166. // ==================== ACCESS =======================
  167. // ==================== INQUIRY =======================
  168. /**
  169. * Returns the name of the underlying class, similiar to Python's type
  170. * @return string of class name
  171. */
  172. virtual inline std::string GetName() const {
  173. return CName;
  174. }
  175. protected:
  176. // ==================== LIFECYCLE =======================
  177. /** Copy is disabled */
  178. |CLASSNAME|( const |CLASSNAME|& ) = delete;
  179. // ==================== DATA MEMBERS =========================
  180. private:
  181. /** ASCII string representation of the class name */
  182. static constexpr auto CName = "|CLASSNAME|";
  183. }; // ----- end of class |CLASSNAME| -----
  184. } // ----- end of namespace Lemma ----
  185. /* vim: set tabstop=4 expandtab: */
  186. /* vim: set filetype=cpp: */
  187. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  188. == cpp.class-definitionLemmaAbstract ==
  189. /**
  190. \brief <CURSOR>
  191. \details
  192. */
  193. class |?CLASSNAME:c| : public |?BASECLASS:c| {
  194. friend std::ostream &operator<<(std::ostream &stream,
  195. const |CLASSNAME| &ob) {
  196. stream << *(|BASECLASS|*)(&ob);
  197. return stream;
  198. }
  199. public:
  200. // ==================== LIFECYCLE =======================
  201. // ==================== OPERATORS =======================
  202. // ==================== OPERATIONS =======================
  203. virtual void APIDemo()=0; // REMEMBER TO MAKE PURE VIRTUAL DUMMY
  204. // ==================== ACCESS =======================
  205. // ==================== INQUIRY =======================
  206. protected:
  207. // ==================== LIFECYCLE =======================
  208. /** Default protected constructor, abstract class this cannot be called */
  209. |CLASSNAME| (const std::string& name);
  210. /** Default protected destructor, this is an abstract class, this cannot be called */
  211. ~|CLASSNAME| ();
  212. // ==================== DATA MEMBERS =========================
  213. private:
  214. }; // ----- end of class |CLASSNAME| -----
  215. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  216. == cpp.class-implementationLemma ==
  217. #include "|?CLASSNAME|.h"
  218. namespace Lemma {
  219. // ==================== FRIEND METHODS =====================
  220. std::ostream &operator << (std::ostream &stream, const |CLASSNAME| &ob) {
  221. stream << ob.Serialize() << "\n---\n"; // End of doc ---
  222. return stream;
  223. }
  224. // ==================== LIFECYCLE =======================
  225. //--------------------------------------------------------------------------------------
  226. // Class: |CLASSNAME|
  227. // Method: |CLASSNAME|
  228. // Description: constructor (locked)
  229. //--------------------------------------------------------------------------------------
  230. |CLASSNAME|::|CLASSNAME| (const ctor_key&) : |?BASECLASS|( |BASECLASS|::ctor_key() ) {
  231. } // ----- end of method |CLASSNAME|::|CLASSNAME| (constructor) -----
  232. //--------------------------------------------------------------------------------------
  233. // Class: |CLASSNAME|
  234. // Method: |CLASSNAME|
  235. // Description: DeSerializing constructor (locked)
  236. //--------------------------------------------------------------------------------------
  237. |CLASSNAME|::|CLASSNAME| (const YAML::Node& node, const ctor_key&) : |BASECLASS|(node, |BASECLASS|::ctor_key()) {
  238. } // ----- end of method |CLASSNAME|::|CLASSNAME| (constructor) -----
  239. //--------------------------------------------------------------------------------------
  240. // Class: |CLASSNAME|
  241. // Method: NewSP()
  242. // Description: public constructor returing a shared_ptr
  243. //--------------------------------------------------------------------------------------
  244. std::shared_ptr< |CLASSNAME| > |CLASSNAME|::NewSP() {
  245. return std::make_shared< |CLASSNAME| >( ctor_key() );
  246. }
  247. //--------------------------------------------------------------------------------------
  248. // Class: |CLASSNAME|
  249. // Method: ~|CLASSNAME|
  250. // Description: destructor (protected)
  251. //--------------------------------------------------------------------------------------
  252. |CLASSNAME|::~|CLASSNAME| () {
  253. } // ----- end of method |CLASSNAME|::~|CLASSNAME| (destructor) -----
  254. //--------------------------------------------------------------------------------------
  255. // Class: |CLASSNAME|
  256. // Method: Serialize
  257. //--------------------------------------------------------------------------------------
  258. YAML::Node |CLASSNAME|::Serialize ( ) const {
  259. YAML::Node node = |BASECLASS|::Serialize();
  260. node.SetTag( GetName() );
  261. // FILL IN CLASS SPECIFICS HERE
  262. return node;
  263. } // ----- end of method |CLASSNAME|::Serialize -----
  264. //--------------------------------------------------------------------------------------
  265. // Class: |CLASSNAME|
  266. // Method: DeSerialize
  267. //--------------------------------------------------------------------------------------
  268. std::shared_ptr<|CLASSNAME|> |CLASSNAME|::DeSerialize ( const YAML::Node& node ) {
  269. if (node.Tag() != "|CLASSNAME|" ) {
  270. throw DeSerializeTypeMismatch( "|CLASSNAME|", node.Tag());
  271. }
  272. return std::make_shared< |CLASSNAME| > ( node, ctor_key() );
  273. } // ----- end of method |CLASSNAME|::DeSerialize -----
  274. } // ---- end of namespace Lemma ----
  275. /* vim: set tabstop=4 expandtab: */
  276. /* vim: set filetype=cpp: */
  277. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  278. == cpp.class-implementation ==
  279. // ==================== LIFECYCLE =======================
  280. //--------------------------------------------------------------------------------------
  281. // Class: |CLASSNAME|
  282. // Method: |CLASSNAME|
  283. // Description: constructor (protected)
  284. //--------------------------------------------------------------------------------------
  285. |CLASSNAME|::|CLASSNAME| ( ) : |BASECLASS|(name) {
  286. } // ----- end of method |CLASSNAME|::|CLASSNAME| (constructor) -----
  287. //--------------------------------------------------------------------------------------
  288. // Class: |CLASSNAME|
  289. // Method: ~|CLASSNAME|
  290. // Description: destructor
  291. //--------------------------------------------------------------------------------------
  292. |CLASSNAME|::~|CLASSNAME| () {
  293. <CURSOR>
  294. } // ----- end of method |CLASSNAME|::~|CLASSNAME| (destructor) -----
  295. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  296. == cpp.class-using-new-definition ==
  297. // =====================================================================================
  298. // Class: |?CLASSNAME:c|
  299. // Description: <CURSOR>
  300. // =====================================================================================
  301. class |CLASSNAME|
  302. {
  303. public:
  304. // ==================== LIFECYCLE =======================================
  305. |CLASSNAME| (); // constructor
  306. |CLASSNAME| ( const |CLASSNAME| &other ); // copy constructor
  307. ~|CLASSNAME| (); // destructor
  308. // ==================== OPERATORS =======================================
  309. const |CLASSNAME|& operator = ( const |CLASSNAME| &other ); // assignment operator
  310. // ==================== OPERATIONS =======================================
  311. // ==================== ACCESS =======================================
  312. // ==================== INQUIRY =======================================
  313. // ==================== DATA MEMBERS =======================================
  314. protected:
  315. private:
  316. }; // ----- end of class |CLASSNAME| -----
  317. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  318. == cpp.class-using-new-implementation ==
  319. //--------------------------------------------------------------------------------------
  320. // Class: |?CLASSNAME|
  321. // Method: |CLASSNAME|
  322. // Description: constructor
  323. //--------------------------------------------------------------------------------------
  324. |CLASSNAME|::|CLASSNAME| ()
  325. {
  326. } // ----- end of method |CLASSNAME|::|CLASSNAME| (constructor) -----
  327. //--------------------------------------------------------------------------------------
  328. // Class: |CLASSNAME|
  329. // Method: |CLASSNAME|
  330. // Description: copy constructor
  331. //--------------------------------------------------------------------------------------
  332. |CLASSNAME|::|CLASSNAME| ( const |CLASSNAME| &other )
  333. {
  334. } // ----- end of method |CLASSNAME|::|CLASSNAME| (copy constructor) -----
  335. //--------------------------------------------------------------------------------------
  336. // Class: |CLASSNAME|
  337. // Method: ~|CLASSNAME|
  338. // Description: destructor
  339. //--------------------------------------------------------------------------------------
  340. |CLASSNAME|::~|CLASSNAME| ()
  341. {
  342. } // ----- end of method |CLASSNAME|::~|CLASSNAME| (destructor) -----
  343. //--------------------------------------------------------------------------------------
  344. // Class: |CLASSNAME|
  345. // Method: operator =
  346. // Description: assignment operator
  347. //--------------------------------------------------------------------------------------
  348. const |CLASSNAME|&
  349. |CLASSNAME|::operator = ( const |CLASSNAME| &other )
  350. {
  351. if ( this != &other ) {
  352. }
  353. return *this;
  354. } // ----- end of method |CLASSNAME|::operator = (assignment operator) -----
  355. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  356. == cpp.error-class ==
  357. // =====================================================================================
  358. // Class: |?CLASSNAME:c|
  359. // Description: <CURSOR>
  360. // =====================================================================================
  361. class |CLASSNAME|
  362. {
  363. public: |CLASSNAME| ( string msg = "|CLASSNAME|" ):message(msg) { }
  364. virtual ~|CLASSNAME| ( ) { }
  365. virtual string what ( ) const throw ( ) { return message; }
  366. protected: string message;
  367. }; // ---------- end of class |CLASSNAME| ----------
  368. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  369. == cpp.template-method-implementation ==
  370. template < class T >
  371. void<CURSOR> |?CLASSNAME|<T>::|?METHODNAME| ( )
  372. {
  373. return ;
  374. } // ----- end of method |CLASSNAME|<T>::|METHODNAME| -----
  375. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  376. == cpp.template-accessor-implementation ==
  377. //--------------------------------------------------------------------------------------
  378. // Class: |?CLASSNAME|
  379. // Method: get_|?ATTRIBUTE|
  380. //--------------------------------------------------------------------------------------
  381. template < class T >
  382. inline <CURSOR>int |CLASSNAME|<T>::get_|ATTRIBUTE| ( )
  383. {
  384. return |ATTRIBUTE|;
  385. } // ----- end of method |CLASSNAME|<T>::get_|ATTRIBUTE| -----
  386. //--------------------------------------------------------------------------------------
  387. // Class: |CLASSNAME|
  388. // Method: set_|ATTRIBUTE|
  389. //--------------------------------------------------------------------------------------
  390. template < class T >
  391. inline void |CLASSNAME|<T>::set_|ATTRIBUTE| ( int value )
  392. {
  393. |ATTRIBUTE| = value;
  394. return ;
  395. } // ----- end of method |CLASSNAME|<T>::set_|ATTRIBUTE| -----
  396. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  397. == cpp.template-class-definition ==
  398. // =====================================================================================
  399. // Class: |?CLASSNAME:c|
  400. // Description: <CURSOR>
  401. // =====================================================================================
  402. template < class T >
  403. class |CLASSNAME|
  404. {
  405. public:
  406. // ==================== LIFECYCLE =======================================
  407. |CLASSNAME| (); // constructor
  408. // ==================== OPERATORS =======================================
  409. // ==================== OPERATIONS =======================================
  410. // ==================== ACCESS =======================================
  411. // ==================== INQUIRY =======================================
  412. // ==================== DATA MEMBERS =======================================
  413. protected:
  414. private:
  415. }; // ----- end of template class |CLASSNAME| -----
  416. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  417. == cpp.template-class-implementation ==
  418. //--------------------------------------------------------------------------------------
  419. // Class: |?CLASSNAME|
  420. // Method: |CLASSNAME|
  421. // Description: constructor
  422. //--------------------------------------------------------------------------------------
  423. template < class T >
  424. |CLASSNAME| <T>:: |CLASSNAME| ()
  425. {
  426. } // ----- end of constructor of template class |CLASSNAME| -----
  427. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  428. == cpp.template-class-using-new-definition ==
  429. // =====================================================================================
  430. // Class: |?CLASSNAME:c|
  431. // Description: <CURSOR>
  432. // =====================================================================================
  433. template < class T >
  434. class |CLASSNAME|
  435. {
  436. public:
  437. // ==================== LIFECYCLE =======================================
  438. |CLASSNAME| (); // constructor
  439. |CLASSNAME| ( const |CLASSNAME| &other ); // copy constructor
  440. ~|CLASSNAME| (); // destructor
  441. // ==================== OPERATORS =======================================
  442. const |CLASSNAME|& operator = ( const |CLASSNAME| &other ); // assignment operator
  443. // ==================== OPERATIONS =======================================
  444. // ==================== ACCESS =======================================
  445. // ==================== INQUIRY =======================================
  446. // ==================== DATA MEMBERS =======================================
  447. protected:
  448. private:
  449. }; // ----- end of template class |CLASSNAME| -----
  450. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  451. == cpp.template-class-using-new-implementation ==
  452. //--------------------------------------------------------------------------------------
  453. // Class: |?CLASSNAME|
  454. // Method: |CLASSNAME|
  455. // Description: constructor
  456. //--------------------------------------------------------------------------------------
  457. template < class T >
  458. |CLASSNAME|<T>::|CLASSNAME| ()
  459. {
  460. } // ----- end of constructor of template class |CLASSNAME| -----
  461. //--------------------------------------------------------------------------------------
  462. // Class: |CLASSNAME|
  463. // Method: |CLASSNAME|
  464. // Description: copy constructor
  465. //--------------------------------------------------------------------------------------
  466. template < class T >
  467. |CLASSNAME|<T>::|CLASSNAME| ( const |CLASSNAME| &other )
  468. {
  469. } // ----- end of copy constructor of template class |CLASSNAME| -----
  470. //--------------------------------------------------------------------------------------
  471. // Class: |CLASSNAME|
  472. // Method: ~|CLASSNAME|
  473. // Description: destructor
  474. //--------------------------------------------------------------------------------------
  475. template < class T >
  476. |CLASSNAME|<T>::~|CLASSNAME| ()
  477. {
  478. } // ----- end of destructor of template class |CLASSNAME| -----
  479. //--------------------------------------------------------------------------------------
  480. // Class: |CLASSNAME|
  481. // Method: operator =
  482. // Description: assignment operator
  483. //--------------------------------------------------------------------------------------
  484. template < class T >
  485. const |CLASSNAME|<T>& |CLASSNAME|<T>::operator = ( const |CLASSNAME| &other )
  486. {
  487. if ( this != &other ) {
  488. }
  489. return *this;
  490. } // ----- end of assignment operator of template class |CLASSNAME| -----
  491. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  492. == cpp.template-function ==
  493. template <class T>
  494. <CURSOR>void |?TEMPALTE_FUNCTION_NAME| ( T param )
  495. {
  496. return ;
  497. } // ----- end of template function |?TEMPALTE_FUNCTION_NAME| -----
  498. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  499. == cpp.operator-in ==
  500. ostream &
  501. operator << ( ostream & os, const |?CLASSNAME| & obj )
  502. {
  503. os << obj.<CURSOR> ;
  504. return os;
  505. } // ----- end of function operator << -----
  506. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  507. == cpp.operator-out ==
  508. istream &
  509. operator >> ( istream & is, |?CLASSNAME| & obj )
  510. {
  511. is >> obj.<CURSOR> ;
  512. return is;
  513. } // ----- end of function operator >> -----
  514. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  515. == cpp.try-catch ==
  516. try {
  517. <SPLIT>}
  518. catch ( const <CURSOR> &ExceptObj ) { // handle exception:
  519. }
  520. catch (...) { // handle exception: unspezified
  521. }
  522. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  523. == cpp.catch ==
  524. catch ( <CURSOR>const &ExceptObj ) { // handle exception:
  525. <SPLIT>}
  526. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  527. == cpp.catch-points ==
  528. catch (...) { // handle exception:
  529. <SPLIT>}
  530. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  531. == cpp.extern ==
  532. extern "C" {<CURSOR>
  533. <SPLIT>}
  534. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  535. == cpp.open-input-file ==
  536. string ifs_file_name = "<CURSOR>"; // input file name
  537. ifstream ifs; // create ifstream object
  538. ifs.open ( ifs_file_name.c_str() ); // open ifstream
  539. if (!ifs) {
  540. cerr << "\nERROR : failed to open input file " << ifs_file_name << endl;
  541. exit (EXIT_FAILURE);
  542. }
  543. ifs.close (); // close ifstream
  544. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  545. == cpp.open-output-file ==
  546. string ofs_file_name = "<CURSOR>"; // input file name
  547. ofstream ofs; // create ofstream object
  548. ofs.open ( ofs_file_name.c_str() ); // open ofstream
  549. if (!ofs) {
  550. cerr << "\nERROR : failed to open output file " << ofs_file_name << endl;
  551. exit (EXIT_FAILURE);
  552. }
  553. ofs.close (); // close ofstream
  554. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  555. == cpp.namespace-std ==
  556. using namespace std;
  557. == cpp.namespace ==
  558. using namespace |?NAMESPACE|;
  559. == cpp.namespace-block ==
  560. namespace |?NAMESPACE| {
  561. <CURSOR>
  562. <SPLIT>} // ----- end of |NAMESPACE| name -----
  563. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  564. == cpp.rtti-typeid == insert ==
  565. typeid(<CURSOR><SPLIT>)
  566. $
  567. == cpp.rtti-static-cast == insert ==
  568. static_cast<>(<CURSOR><SPLIT>)
  569. $
  570. == cpp.rtti-const-cast == insert ==
  571. const_cast<>(<CURSOR><SPLIT>)
  572. $
  573. == cpp.rtti-reinterpret-cast == insert ==
  574. reinterpret_cast<>(<CURSOR><SPLIT>)
  575. $
  576. == cpp.rtti-dynamic-cast == insert ==
  577. dynamic_cast<>(<CURSOR><SPLIT>)
  578. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  579. /* vim: set tabstop=4 expandtab: */
  580. /* vim: set filetype=cpp: */