]> Creatis software - cpPlugins.git/blob - lib/cpPlugins/Object.cxx
Moved to version 1.0
[cpPlugins.git] / lib / cpPlugins / Object.cxx
1 // =========================================================================
2 // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
3 // =========================================================================
4
5 #include <cpPlugins/Object.h>
6 #include <cxxabi.h>
7 #include <sstream>
8
9 // -------------------------------------------------------------------------
10 namespace cpPlugins
11 {
12   const Object::TTimeStamp Object::ZeroTimeStamp =
13     Object::TTimeStamp( Object::TTimeRep::duration::zero( ) );
14 } // end namespace
15
16 // -------------------------------------------------------------------------
17 const std::type_info& cpPlugins::Object::
18 GetClassType( ) const
19 {
20   return( typeid( *this ) );
21 }
22
23 // -------------------------------------------------------------------------
24 std::string cpPlugins::Object::
25 GetClassName( ) const
26 {
27   int status = -4;
28   std::string name = this->GetClassType( ).name( );
29   std::unique_ptr< char, void(*)( void* ) > res
30   { abi::__cxa_demangle( name.c_str( ), NULL, NULL, &status ), std::free };
31   if( status == 0 )
32     name = res.get( );
33   else
34     name = "";
35   return( name );
36 }
37
38 // -------------------------------------------------------------------------
39 void cpPlugins::Object::
40 Print( std::ostream& o ) const
41 {
42   o << this->GetClassName( ) << ": (" << this << ")" << std::endl;
43 }
44
45 // -------------------------------------------------------------------------
46 const cpPlugins::Object::
47 TTimeStamp& cpPlugins::Object::
48 GetLastTimeStamp( ) const
49 {
50   return( this->m_LastTimeStamp );
51 }
52
53 // -------------------------------------------------------------------------
54 bool cpPlugins::Object::
55 IsUpdated( const TTimeStamp& d ) const
56 {
57   return(
58     this->m_LastTimeStamp < d &&
59     Self::ZeroTimeStamp < this->m_LastTimeStamp
60     );
61 }
62
63 // -------------------------------------------------------------------------
64 void cpPlugins::Object::
65 Modified( )
66 {
67   this->m_LastTimeStamp = Self::ZeroTimeStamp;
68 }
69
70 // -------------------------------------------------------------------------
71 cpPlugins::Object::
72 Object( )
73 {
74   this->Modified( );
75 }
76
77 // -------------------------------------------------------------------------
78 cpPlugins::Object::
79 ~Object( )
80 {
81 }
82
83 // -------------------------------------------------------------------------
84 void cpPlugins::Object::
85 _Configure( )
86 {
87   // Do nothing at this level
88 }
89
90 // -------------------------------------------------------------------------
91 void cpPlugins::Object::
92 _SynchTime( )
93 {
94   this->m_LastTimeStamp = TTimeRep::now( );
95 }
96
97 // eof - $RCSfile$