ALBA
albaObject.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: albaObject
5 Authors: Marco Petrone
6
7 Copyright (c) BIC
8 All rights reserved. See Copyright.txt or
9
10
11 This software is distributed WITHOUT ANY WARRANTY; without even
12 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE. See the above copyright notice for more information.
14
15=========================================================================*/
16
17#ifndef __albaObject_h
18#define __albaObject_h
19
20#include "albaDefines.h"
21
22//------------------------------------------------------------------------------
23// Forward declarations
24//------------------------------------------------------------------------------
25
26//------------------------------------------------------------------------------
27// albaObject
28//------------------------------------------------------------------------------
37class ALBA_EXPORT albaObject
38{
39public:
41 virtual ~albaObject();
42
44 virtual void Delete() {delete this;};
45
47 static const char *GetStaticTypeName();
48
50 virtual const char *GetTypeName() const;
51
53 static bool IsStaticType(const char *type_name);
54
56 static bool IsStaticType(const albaTypeID &type_id);
57
59 virtual bool IsA(const char *type_name) const;
60
62 virtual bool IsA(const albaTypeID &type_id) const;
63
65 virtual albaObject *NewObjectInstance() const = 0;
66
68 static const albaTypeID &GetStaticTypeId();
69
71 virtual const albaTypeID &GetTypeId() const;
72
75
77 virtual void Print(std::ostream &os, const int indent=0) const;
78
80
81#ifndef _DEBUG
82 #ifdef _WIN32
83 // avoid dll boundary problems
84 void* operator new( size_t tSize );
85 void operator delete( void* p );
86 #endif
87#endif
88
89protected:
91};
92#endif /* __albaObject_h */
std::type_info albaTypeID
type for albaObject's class type IDs
Definition: albaDefines.h:59
Abstract superclass for all ALBA classes implementing RTTI APIs.
Definition: albaObject.h:38
virtual bool IsA(const char *type_name) const
Check the class name of this instance.
static const albaTypeID & GetStaticTypeId()
Return TypeId for this type (static function, i.e.
bool m_HeapFlag
Internally used to mark objects created on the Heap with New()
Definition: albaObject.h:90
virtual void Print(std::ostream &os, const int indent=0) const
print debug information for this object
static albaObject * SafeDownCast(albaObject *o)
Cast with dynamic type checking.
virtual ~albaObject()
albaObject(const albaObject &c)
Definition: albaObject.h:79
static const char * GetStaticTypeName()
Return the name of this type (static function)
static bool IsStaticType(const albaTypeID &type_id)
This is used by IsA to check the class type id.
virtual albaObject * NewObjectInstance() const =0
Return a new instance of the same type.
virtual bool IsA(const albaTypeID &type_id) const
Check the type id of this instance.
static bool IsStaticType(const char *type_name)
This is used by IsA to check the class name.
virtual const char * GetTypeName() const
Return the class name of this instance.
virtual const albaTypeID & GetTypeId() const
Return TypeId for this object instance (the real type)
virtual void Delete()
the same as delete obj, implemented for syntax compatibility
Definition: albaObject.h:44