NEST  2.6.0,not_revisioned_source_dir@0
lockptrdatum_impl.h
Go to the documentation of this file.
1 /*
2  * lockptrdatum_impl.h
3  *
4  * This file is part of NEST.
5  *
6  * Copyright (C) 2004 The NEST Initiative
7  *
8  * NEST is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * NEST is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with NEST. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #ifndef LOCKPTRDATUMIMPL_H
24 #define LOCKPTRDATUMIMPL_H
25 
26 #include "lockptrdatum.h"
27 
28 /* equals(const Datum* datum)
29  returns: true if *this and Datum *dat are both lockptr references
30  to the same underlying object.
31 
32  The definition of the equals method assumes that no further
33  distinguishing data is added by derivation. Aka, the template
34  class is never inherited from, and therefore type equality is
35  guaranteed by template parameter equality.
36 */
37 template <class D, SLIType *slt>
38 bool lockPTRDatum<D, slt>::equals(const Datum *dat) const
39 {
40  const lockPTRDatum<D,slt>* ddc
41  = dynamic_cast<const lockPTRDatum<D, slt>*>(dat);
42  return ddc && lockPTR<D>::operator==(*ddc);
43 }
44 
45 template <class D, SLIType *slt>
46 void lockPTRDatum<D, slt>::pprint(std::ostream &out) const
47 {
48  out << "<lockPTR["<< this->references()<<"]->"
49  << this->gettypename()
50  << '(' << static_cast<void *>(this->get()) <<")>";
51  this->unlock();
52 }
53 
54 template <class D, SLIType *slt>
55 void lockPTRDatum<D, slt>::print(std::ostream &out) const
56 {
57  out << '<' << this->gettypename() << '>';
58 }
59 
60 template <class D, SLIType *slt>
61 void lockPTRDatum<D, slt>::info(std::ostream &out) const
62 {
63 // out << *dynamic_cast<C *>(const_cast<lockPTR<C,slt> *>(this));
64  pprint(out);
65 }
66 
67 #endif
void pprint(std::ostream &) const
Definition: lockptrdatum_impl.h:46
Definition: lockptrdatum.h:40
bool operator==(const lockPTR< D > &p) const
Definition: lockptr.h:296
void info(std::ostream &) const
Definition: lockptrdatum_impl.h:61
bool equals(const Datum *) const
Definition: lockptrdatum_impl.h:38
Definition: datum.h:33
void print(std::ostream &) const
Definition: lockptrdatum_impl.h:55