Classes |
|
class | BALL::Exception::GeneralException |
General exception class. More... |
|
class | BALL::HashFunction< T > |
General Hash Function Template.
More... |
|
class | BALL::Limits< T > |
Numeric limits class. More... |
|
class | BALL::VersionInfo |
Version information class. More... |
|
Namespaces |
|
namespace | BALL::Constants |
The constants namespace. |
|
namespace | BALL::Exception |
Exception. |
|
namespace | BALL::RTTI |
Simplified RunTime Type
Identification. |
|
Functions |
|
BALL_EXPORT std::ostream & | BALL::operator<< (std::ostream &os, const Exception::GeneralException &e) |
Output operator for exceptions.
|
|
BALL_EXPORT string | BALL::streamClassName (const std::type_info &t) |
Returns a unique name for a class.
|
|
#define | BALL_CREATE_DEEP(name) |
Virtual construction macro. |
|
#define | BALL_CREATE(name) |
Virtual construction macro. |
|
#define | BALL_DEFINE_CREATE(name) |
Virtual cloning method definition
macro. |
#define BALL_CREATE | ( | name | ) |
Value:
\ virtual void* create(bool /* deep */ = true, bool empty = false) const\ {\ void* ptr;\ if (empty == true)\ {\ ptr = (void*)new name;\ }\ else\ {\ ptr = (void*)new name(*this);\ }\ \ return ptr;\ }\ \ static void* createDefault()\ {\ return static_cast<void*>(new name);\ }
This macro is used to define the virtual create
method for classes that do not define a copy constructor
taking a second argument (boolean, deep or shallow copy).
On inclusion of this macro in the public interface of a
class, the virtual creation method becomes available. The
create method's signature is as follows: virtual
void* create(bool deep = true, bool empty = false)
const
empty == true
)
or a copy of the object. The use of the create method
requires a (public) default constructor (when creating an
empty copy) and a copy constructor taking a reference to
an object. The macro also implements a static method
createDefault
that returns a void pointer to
a new instance of name
.name | the class name |
#define BALL_CREATE_DEEP | ( | name | ) |
Value:
\ virtual void* create(bool deep = true, bool empty = false) const\ {\ void* ptr;\ if (empty == true)\ {\ ptr = (void*)new name;\ }\ else\ {\ ptr = (void*)new name(*this, deep);\ }\ \ return ptr;\ }\ \ static void* createDefault()\ {\ return static_cast<void*>(new name);\ }
This macro is used to define the virtual create
method. On inclusion of this macro in the public interface
of a class, the virtual creation method becomes available.
The create method's signature is as follows: virtual
void* create(bool deep = true, bool empty = false)
const
empty == true
)
or a copy of the object. The copy is either deep
(deep == true
) or shallow (deep
== false
). By default, the create methods
returns a pointer to a deep copy of the object. The use
of the create method requires a (public) default
constructor (when creating an empty copy) or a copy
constructor.createDefault
that returns a void pointer to
a new instance of name
.name | the class name |
#define BALL_DEFINE_CREATE | ( | name | ) |
Value:
\ virtual void* create(bool deep = true, bool empty = false) const;\ static void* createDefault();
If the create method has to be implemented by the user, this macro just defines the create method and the createDefault method. The function signatures are:
virtual void* create(bool deep = true, bool empty = false) const; static void* createDefault();
BALL_EXPORT std::ostream& BALL::operator<< | ( | std::ostream & | os, | |
const Exception::GeneralException & | e | |||
) |
Output operator for exceptions.
All BALL exceptions can be printed to an arbitrary output stream. Information written contains the exception class, the error message, and the location (file, line number). The following code block can thus be used to catch any BALL exceptions and convert them to human readable information:
try { .... // some code which potentially throws an exception } catch (Exception::GeneralException& e) { Log.error() << "caught exception: " << e << std::endl; }
BALL_EXPORT string BALL::streamClassName | ( | const std::type_info & | t | ) |
Returns a unique name for a class.
This name contains no blanks. It is usually derived by
substituting all blanks in the name (as returned by
RTTI::getName())
with underscores ("_"). In the case of gcc
,
however a name demangling decodes the string first. This
function is needed for object persistence.
t | the type_info structure as
returned by typeid |
Referenced by BALL::RTTI::getStreamName().