Lemma is an Electromagnetics API
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cpp.cpp.template 25KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  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. \brief <CURSOR>
  109. \details
  110. */
  111. class |?CLASSNAME:c| : public |BASECLASS:c| {
  112. friend std::ostream &operator<<(std::ostream &stream, const |CLASSNAME| &ob);
  113. /*
  114. * This key is used to lock the constructor.
  115. */
  116. struct ctor_key {};
  117. public:
  118. // ==================== LIFECYCLE =======================
  119. /**
  120. * Default constructor.
  121. * @note This method is locked, and cannot be called directly.
  122. * The reason that the method is public is to enable the use
  123. * of make_shared whilst enforcing the use of shared_ptr,
  124. * in c++-17, this curiosity may be resolved.
  125. * @see |CLASSNAME|::NewSP
  126. */
  127. explicit |CLASSNAME| ( const ctor_key& );
  128. /**
  129. * DeSerializing constructor.
  130. * @note This method is locked, and cannot be called directly.
  131. * The reason that the method is public is to enable the use
  132. * of make_shared whilst enforcing the use of shared_ptr,
  133. * in c++-17, this curiosity may be resolved.
  134. * @see |CLASSNAME|::DeSerialize
  135. */
  136. |CLASSNAME| (const YAML::Node& node);
  137. /**
  138. * Default destructor.
  139. * @note This method should never be called due to the mandated
  140. * use of smart pointers. It is necessary to keep the method
  141. * public in order to allow for the use of the more efficeint
  142. * make_shared constructor.
  143. */
  144. virtual ~|CLASSNAME| ();
  145. /**
  146. * Uses YAML to serialize this object.
  147. * @return a YAML::Node
  148. * @see |CLASSNAME|::DeSerialize
  149. */
  150. virtual YAML::Node Serialize() const;
  151. /*
  152. * Factory method for generating concrete class.
  153. * @return a std::shared_ptr of type |CLASSNAME|
  154. */
  155. static std::shared_ptr< |CLASSNAME| > NewSP();
  156. /**
  157. * Constructs an |CLASSNAME| object from a YAML::Node.
  158. * @see |CLASSNAME|::Serialize
  159. */
  160. static std::shared_ptr<|CLASSNAME|> DeSerialize(const YAML::Node& node);
  161. // ==================== OPERATORS =======================
  162. // ==================== OPERATIONS =======================
  163. // ==================== ACCESS =======================
  164. // ==================== INQUIRY =======================
  165. protected:
  166. // ==================== LIFECYCLE =======================
  167. // ==================== DATA MEMBERS =========================
  168. private:
  169. /** ASCII string representation of the class name */
  170. static constexpr auto CName = "|CLASSNAME|";
  171. }; // ----- end of class |CLASSNAME| -----
  172. } // ----- end of namespace Lemma ----
  173. /* vim: set tabstop=4 expandtab: */
  174. /* vim: set filetype=cpp: */
  175. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  176. == cpp.class-definitionLemmaAbstract ==
  177. /**
  178. \brief <CURSOR>
  179. \details
  180. */
  181. class |?CLASSNAME:c| : public |?BASECLASS:c| {
  182. friend std::ostream &operator<<(std::ostream &stream,
  183. const |CLASSNAME| &ob) {
  184. stream << *(|BASECLASS|*)(&ob);
  185. return stream;
  186. }
  187. public:
  188. // ==================== LIFECYCLE =======================
  189. // ==================== OPERATORS =======================
  190. // ==================== OPERATIONS =======================
  191. virtual void APIDemo()=0; // REMEMBER TO MAKE PURE VIRTUAL DUMMY
  192. // ==================== ACCESS =======================
  193. // ==================== INQUIRY =======================
  194. protected:
  195. // ==================== LIFECYCLE =======================
  196. /** Default protected constructor, abstract class this cannot be called */
  197. |CLASSNAME| (const std::string& name);
  198. /** Default protected destructor, this is an abstract class, this cannot be called */
  199. ~|CLASSNAME| ();
  200. // ==================== DATA MEMBERS =========================
  201. private:
  202. }; // ----- end of class |CLASSNAME| -----
  203. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  204. == cpp.class-implementationLemma ==
  205. #include "|?CLASSNAME|.h"
  206. namespace Lemma {
  207. // ==================== FRIEND METHODS =====================
  208. std::ostream &operator << (std::ostream &stream, const |CLASSNAME| &ob) {
  209. stream << ob.Serialize() << "\n---\n"; // End of doc --- as a direct stream should encapulste thingy
  210. return stream;
  211. }
  212. // ==================== LIFECYCLE =======================
  213. //--------------------------------------------------------------------------------------
  214. // Class: |CLASSNAME|
  215. // Method: |CLASSNAME|
  216. // Description: constructor (protected)
  217. //--------------------------------------------------------------------------------------
  218. |CLASSNAME|::|CLASSNAME| (const std::string& name) : |?BASECLASS|(name) {
  219. } // ----- end of method |CLASSNAME|::|CLASSNAME| (constructor) -----
  220. //--------------------------------------------------------------------------------------
  221. // Class: |CLASSNAME|
  222. // Method: |CLASSNAME|
  223. // Description: DeSerializing constructor (protected)
  224. //--------------------------------------------------------------------------------------
  225. |CLASSNAME|::|CLASSNAME| (const YAML::Node& node) : |BASECLASS|(node) {
  226. } // ----- end of method |CLASSNAME|::|CLASSNAME| (constructor) -----
  227. //--------------------------------------------------------------------------------------
  228. // Class: |CLASSNAME|
  229. // Method: NewSP()
  230. // Description: public constructor returing a shared_ptr
  231. //--------------------------------------------------------------------------------------
  232. std::shared_ptr< |CLASSNAME| > |CLASSNAME|::NewSP() {
  233. std::shared_ptr< |CLASSNAME| > sp(new |CLASSNAME|("|CLASSNAME|"), LemmaObjectDeleter() );
  234. return sp;
  235. }
  236. //--------------------------------------------------------------------------------------
  237. // Class: |CLASSNAME|
  238. // Method: ~|CLASSNAME|
  239. // Description: destructor (protected)
  240. //--------------------------------------------------------------------------------------
  241. |CLASSNAME|::~|CLASSNAME| () {
  242. } // ----- end of method |CLASSNAME|::~|CLASSNAME| (destructor) -----
  243. //--------------------------------------------------------------------------------------
  244. // Class: |CLASSNAME|
  245. // Method: Serialize
  246. //--------------------------------------------------------------------------------------
  247. YAML::Node |CLASSNAME|::Serialize ( ) const {
  248. YAML::Node node = |BASECLASS|::Serialize();
  249. node.SetTag( GetName() );
  250. // FILL IN CLASS SPECIFICS HERE
  251. return node;
  252. } // ----- end of method |CLASSNAME|::Serialize -----
  253. //--------------------------------------------------------------------------------------
  254. // Class: |CLASSNAME|
  255. // Method: DeSerialize
  256. //--------------------------------------------------------------------------------------
  257. std::shared_ptr<|CLASSNAME|> |CLASSNAME|::DeSerialize ( const YAML::Node& node ) {
  258. if (node.Tag() != "|CLASSNAME|" ) {
  259. throw DeSerializeTypeMismatch( "|CLASSNAME|", node.Tag());
  260. }
  261. std::shared_ptr< |CLASSNAME| > Object(new |CLASSNAME|(node), LemmaObjectDeleter() );
  262. return Object ;
  263. } // ----- end of method |CLASSNAME|::DeSerialize -----
  264. } // ---- end of namespace Lemma ----
  265. /* vim: set tabstop=4 expandtab: */
  266. /* vim: set filetype=cpp: */
  267. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  268. == cpp.class-implementation ==
  269. // ==================== LIFECYCLE =======================
  270. //--------------------------------------------------------------------------------------
  271. // Class: |CLASSNAME|
  272. // Method: |CLASSNAME|
  273. // Description: constructor (protected)
  274. //--------------------------------------------------------------------------------------
  275. |CLASSNAME|::|CLASSNAME| ( ) : |BASECLASS|(name) {
  276. } // ----- end of method |CLASSNAME|::|CLASSNAME| (constructor) -----
  277. //--------------------------------------------------------------------------------------
  278. // Class: |CLASSNAME|
  279. // Method: ~|CLASSNAME|
  280. // Description: destructor
  281. //--------------------------------------------------------------------------------------
  282. |CLASSNAME|::~|CLASSNAME| () {
  283. <CURSOR>
  284. } // ----- end of method |CLASSNAME|::~|CLASSNAME| (destructor) -----
  285. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  286. == cpp.class-using-new-definition ==
  287. // =====================================================================================
  288. // Class: |?CLASSNAME:c|
  289. // Description: <CURSOR>
  290. // =====================================================================================
  291. class |CLASSNAME|
  292. {
  293. public:
  294. // ==================== LIFECYCLE =======================================
  295. |CLASSNAME| (); // constructor
  296. |CLASSNAME| ( const |CLASSNAME| &other ); // copy constructor
  297. ~|CLASSNAME| (); // destructor
  298. // ==================== OPERATORS =======================================
  299. const |CLASSNAME|& operator = ( const |CLASSNAME| &other ); // assignment operator
  300. // ==================== OPERATIONS =======================================
  301. // ==================== ACCESS =======================================
  302. // ==================== INQUIRY =======================================
  303. // ==================== DATA MEMBERS =======================================
  304. protected:
  305. private:
  306. }; // ----- end of class |CLASSNAME| -----
  307. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  308. == cpp.class-using-new-implementation ==
  309. //--------------------------------------------------------------------------------------
  310. // Class: |?CLASSNAME|
  311. // Method: |CLASSNAME|
  312. // Description: constructor
  313. //--------------------------------------------------------------------------------------
  314. |CLASSNAME|::|CLASSNAME| ()
  315. {
  316. } // ----- end of method |CLASSNAME|::|CLASSNAME| (constructor) -----
  317. //--------------------------------------------------------------------------------------
  318. // Class: |CLASSNAME|
  319. // Method: |CLASSNAME|
  320. // Description: copy constructor
  321. //--------------------------------------------------------------------------------------
  322. |CLASSNAME|::|CLASSNAME| ( const |CLASSNAME| &other )
  323. {
  324. } // ----- end of method |CLASSNAME|::|CLASSNAME| (copy constructor) -----
  325. //--------------------------------------------------------------------------------------
  326. // Class: |CLASSNAME|
  327. // Method: ~|CLASSNAME|
  328. // Description: destructor
  329. //--------------------------------------------------------------------------------------
  330. |CLASSNAME|::~|CLASSNAME| ()
  331. {
  332. } // ----- end of method |CLASSNAME|::~|CLASSNAME| (destructor) -----
  333. //--------------------------------------------------------------------------------------
  334. // Class: |CLASSNAME|
  335. // Method: operator =
  336. // Description: assignment operator
  337. //--------------------------------------------------------------------------------------
  338. const |CLASSNAME|&
  339. |CLASSNAME|::operator = ( const |CLASSNAME| &other )
  340. {
  341. if ( this != &other ) {
  342. }
  343. return *this;
  344. } // ----- end of method |CLASSNAME|::operator = (assignment operator) -----
  345. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  346. == cpp.error-class ==
  347. // =====================================================================================
  348. // Class: |?CLASSNAME:c|
  349. // Description: <CURSOR>
  350. // =====================================================================================
  351. class |CLASSNAME|
  352. {
  353. public: |CLASSNAME| ( string msg = "|CLASSNAME|" ):message(msg) { }
  354. virtual ~|CLASSNAME| ( ) { }
  355. virtual string what ( ) const throw ( ) { return message; }
  356. protected: string message;
  357. }; // ---------- end of class |CLASSNAME| ----------
  358. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  359. == cpp.template-method-implementation ==
  360. template < class T >
  361. void<CURSOR> |?CLASSNAME|<T>::|?METHODNAME| ( )
  362. {
  363. return ;
  364. } // ----- end of method |CLASSNAME|<T>::|METHODNAME| -----
  365. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  366. == cpp.template-accessor-implementation ==
  367. //--------------------------------------------------------------------------------------
  368. // Class: |?CLASSNAME|
  369. // Method: get_|?ATTRIBUTE|
  370. //--------------------------------------------------------------------------------------
  371. template < class T >
  372. inline <CURSOR>int |CLASSNAME|<T>::get_|ATTRIBUTE| ( )
  373. {
  374. return |ATTRIBUTE|;
  375. } // ----- end of method |CLASSNAME|<T>::get_|ATTRIBUTE| -----
  376. //--------------------------------------------------------------------------------------
  377. // Class: |CLASSNAME|
  378. // Method: set_|ATTRIBUTE|
  379. //--------------------------------------------------------------------------------------
  380. template < class T >
  381. inline void |CLASSNAME|<T>::set_|ATTRIBUTE| ( int value )
  382. {
  383. |ATTRIBUTE| = value;
  384. return ;
  385. } // ----- end of method |CLASSNAME|<T>::set_|ATTRIBUTE| -----
  386. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  387. == cpp.template-class-definition ==
  388. // =====================================================================================
  389. // Class: |?CLASSNAME:c|
  390. // Description: <CURSOR>
  391. // =====================================================================================
  392. template < class T >
  393. class |CLASSNAME|
  394. {
  395. public:
  396. // ==================== LIFECYCLE =======================================
  397. |CLASSNAME| (); // constructor
  398. // ==================== OPERATORS =======================================
  399. // ==================== OPERATIONS =======================================
  400. // ==================== ACCESS =======================================
  401. // ==================== INQUIRY =======================================
  402. // ==================== DATA MEMBERS =======================================
  403. protected:
  404. private:
  405. }; // ----- end of template class |CLASSNAME| -----
  406. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  407. == cpp.template-class-implementation ==
  408. //--------------------------------------------------------------------------------------
  409. // Class: |?CLASSNAME|
  410. // Method: |CLASSNAME|
  411. // Description: constructor
  412. //--------------------------------------------------------------------------------------
  413. template < class T >
  414. |CLASSNAME| <T>:: |CLASSNAME| ()
  415. {
  416. } // ----- end of constructor of template class |CLASSNAME| -----
  417. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  418. == cpp.template-class-using-new-definition ==
  419. // =====================================================================================
  420. // Class: |?CLASSNAME:c|
  421. // Description: <CURSOR>
  422. // =====================================================================================
  423. template < class T >
  424. class |CLASSNAME|
  425. {
  426. public:
  427. // ==================== LIFECYCLE =======================================
  428. |CLASSNAME| (); // constructor
  429. |CLASSNAME| ( const |CLASSNAME| &other ); // copy constructor
  430. ~|CLASSNAME| (); // destructor
  431. // ==================== OPERATORS =======================================
  432. const |CLASSNAME|& operator = ( const |CLASSNAME| &other ); // assignment operator
  433. // ==================== OPERATIONS =======================================
  434. // ==================== ACCESS =======================================
  435. // ==================== INQUIRY =======================================
  436. // ==================== DATA MEMBERS =======================================
  437. protected:
  438. private:
  439. }; // ----- end of template class |CLASSNAME| -----
  440. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  441. == cpp.template-class-using-new-implementation ==
  442. //--------------------------------------------------------------------------------------
  443. // Class: |?CLASSNAME|
  444. // Method: |CLASSNAME|
  445. // Description: constructor
  446. //--------------------------------------------------------------------------------------
  447. template < class T >
  448. |CLASSNAME|<T>::|CLASSNAME| ()
  449. {
  450. } // ----- end of constructor of template class |CLASSNAME| -----
  451. //--------------------------------------------------------------------------------------
  452. // Class: |CLASSNAME|
  453. // Method: |CLASSNAME|
  454. // Description: copy constructor
  455. //--------------------------------------------------------------------------------------
  456. template < class T >
  457. |CLASSNAME|<T>::|CLASSNAME| ( const |CLASSNAME| &other )
  458. {
  459. } // ----- end of copy constructor of template class |CLASSNAME| -----
  460. //--------------------------------------------------------------------------------------
  461. // Class: |CLASSNAME|
  462. // Method: ~|CLASSNAME|
  463. // Description: destructor
  464. //--------------------------------------------------------------------------------------
  465. template < class T >
  466. |CLASSNAME|<T>::~|CLASSNAME| ()
  467. {
  468. } // ----- end of destructor of template class |CLASSNAME| -----
  469. //--------------------------------------------------------------------------------------
  470. // Class: |CLASSNAME|
  471. // Method: operator =
  472. // Description: assignment operator
  473. //--------------------------------------------------------------------------------------
  474. template < class T >
  475. const |CLASSNAME|<T>& |CLASSNAME|<T>::operator = ( const |CLASSNAME| &other )
  476. {
  477. if ( this != &other ) {
  478. }
  479. return *this;
  480. } // ----- end of assignment operator of template class |CLASSNAME| -----
  481. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  482. == cpp.template-function ==
  483. template <class T>
  484. <CURSOR>void |?TEMPALTE_FUNCTION_NAME| ( T param )
  485. {
  486. return ;
  487. } // ----- end of template function |?TEMPALTE_FUNCTION_NAME| -----
  488. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  489. == cpp.operator-in ==
  490. ostream &
  491. operator << ( ostream & os, const |?CLASSNAME| & obj )
  492. {
  493. os << obj.<CURSOR> ;
  494. return os;
  495. } // ----- end of function operator << -----
  496. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  497. == cpp.operator-out ==
  498. istream &
  499. operator >> ( istream & is, |?CLASSNAME| & obj )
  500. {
  501. is >> obj.<CURSOR> ;
  502. return is;
  503. } // ----- end of function operator >> -----
  504. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  505. == cpp.try-catch ==
  506. try {
  507. <SPLIT>}
  508. catch ( const <CURSOR> &ExceptObj ) { // handle exception:
  509. }
  510. catch (...) { // handle exception: unspezified
  511. }
  512. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  513. == cpp.catch ==
  514. catch ( <CURSOR>const &ExceptObj ) { // handle exception:
  515. <SPLIT>}
  516. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  517. == cpp.catch-points ==
  518. catch (...) { // handle exception:
  519. <SPLIT>}
  520. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  521. == cpp.extern ==
  522. extern "C" {<CURSOR>
  523. <SPLIT>}
  524. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  525. == cpp.open-input-file ==
  526. string ifs_file_name = "<CURSOR>"; // input file name
  527. ifstream ifs; // create ifstream object
  528. ifs.open ( ifs_file_name.c_str() ); // open ifstream
  529. if (!ifs) {
  530. cerr << "\nERROR : failed to open input file " << ifs_file_name << endl;
  531. exit (EXIT_FAILURE);
  532. }
  533. ifs.close (); // close ifstream
  534. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  535. == cpp.open-output-file ==
  536. string ofs_file_name = "<CURSOR>"; // input file name
  537. ofstream ofs; // create ofstream object
  538. ofs.open ( ofs_file_name.c_str() ); // open ofstream
  539. if (!ofs) {
  540. cerr << "\nERROR : failed to open output file " << ofs_file_name << endl;
  541. exit (EXIT_FAILURE);
  542. }
  543. ofs.close (); // close ofstream
  544. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  545. == cpp.namespace-std ==
  546. using namespace std;
  547. == cpp.namespace ==
  548. using namespace |?NAMESPACE|;
  549. == cpp.namespace-block ==
  550. namespace |?NAMESPACE| {
  551. <CURSOR>
  552. <SPLIT>} // ----- end of |NAMESPACE| name -----
  553. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  554. == cpp.rtti-typeid == insert ==
  555. typeid(<CURSOR><SPLIT>)
  556. $
  557. == cpp.rtti-static-cast == insert ==
  558. static_cast<>(<CURSOR><SPLIT>)
  559. $
  560. == cpp.rtti-const-cast == insert ==
  561. const_cast<>(<CURSOR><SPLIT>)
  562. $
  563. == cpp.rtti-reinterpret-cast == insert ==
  564. reinterpret_cast<>(<CURSOR><SPLIT>)
  565. $
  566. == cpp.rtti-dynamic-cast == insert ==
  567. dynamic_cast<>(<CURSOR><SPLIT>)
  568. $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  569. /* vim: set tabstop=4 expandtab: */
  570. /* vim: set filetype=cpp: */