]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Object.cxx
Moved to version 1.0
[cpPlugins.git] / lib / cpPlugins / Object.cxx
diff --git a/lib/cpPlugins/Object.cxx b/lib/cpPlugins/Object.cxx
new file mode 100644 (file)
index 0000000..9893c60
--- /dev/null
@@ -0,0 +1,97 @@
+// =========================================================================
+// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+// =========================================================================
+
+#include <cpPlugins/Object.h>
+#include <cxxabi.h>
+#include <sstream>
+
+// -------------------------------------------------------------------------
+namespace cpPlugins
+{
+  const Object::TTimeStamp Object::ZeroTimeStamp =
+    Object::TTimeStamp( Object::TTimeRep::duration::zero( ) );
+} // end namespace
+
+// -------------------------------------------------------------------------
+const std::type_info& cpPlugins::Object::
+GetClassType( ) const
+{
+  return( typeid( *this ) );
+}
+
+// -------------------------------------------------------------------------
+std::string cpPlugins::Object::
+GetClassName( ) const
+{
+  int status = -4;
+  std::string name = this->GetClassType( ).name( );
+  std::unique_ptr< char, void(*)( void* ) > res
+  { abi::__cxa_demangle( name.c_str( ), NULL, NULL, &status ), std::free };
+  if( status == 0 )
+    name = res.get( );
+  else
+    name = "";
+  return( name );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Object::
+Print( std::ostream& o ) const
+{
+  o << this->GetClassName( ) << ": (" << this << ")" << std::endl;
+}
+
+// -------------------------------------------------------------------------
+const cpPlugins::Object::
+TTimeStamp& cpPlugins::Object::
+GetLastTimeStamp( ) const
+{
+  return( this->m_LastTimeStamp );
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Object::
+IsUpdated( const TTimeStamp& d ) const
+{
+  return(
+    this->m_LastTimeStamp < d &&
+    Self::ZeroTimeStamp < this->m_LastTimeStamp
+    );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Object::
+Modified( )
+{
+  this->m_LastTimeStamp = Self::ZeroTimeStamp;
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::Object::
+Object( )
+{
+  this->Modified( );
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::Object::
+~Object( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Object::
+_Configure( )
+{
+  // Do nothing at this level
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Object::
+_SynchTime( )
+{
+  this->m_LastTimeStamp = TTimeRep::now( );
+}
+
+// eof - $RCSfile$