BALL  1.4.79
Namespaces | Classes | Functions
Common Definitions

Namespaces

 BALL::Constants
 
 BALL::Exception
 
 BALL::RTTI
 

Classes

class  BALL::Exception::GeneralException
 
class  BALL::Exception::IndexUnderflow
 
class  BALL::Exception::SizeUnderflow
 
class  BALL::Exception::IndexOverflow
 
class  BALL::Exception::InvalidArgument
 
class  BALL::Exception::InvalidRange
 
class  BALL::Exception::InvalidSize
 
class  BALL::Exception::OutOfRange
 
class  BALL::Exception::InvalidFormat
 
class  BALL::Exception::IllegalSelfOperation
 
class  BALL::Exception::NullPointer
 
class  BALL::Exception::InvalidIterator
 
class  BALL::Exception::IncompatibleIterators
 
class  BALL::Exception::NotImplemented
 
class  BALL::Exception::IllegalTreeOperation
 
class  BALL::Exception::OutOfMemory
 
class  BALL::Exception::BufferOverflow
 
class  BALL::Exception::DivisionByZero
 
class  BALL::Exception::OutOfGrid
 
class  BALL::Exception::FileNotFound
 
class  BALL::Exception::IllegalPosition
 
class  BALL::Exception::ParseError
 
class  BALL::Exception::Precondition
 
class  BALL::Exception::Postcondition
 
class  BALL::Exception::InvalidOption
 Exception to be thrown if an invalid option is given. More...
 
class  BALL::Exception::TooManyErrors
 Exception to be thrown if too many errors occur, e.g. in ForceField. More...
 
class  BALL::Exception::TooManyBonds
 Exception to be thrown if too many bonds for one atom. More...
 
class  BALL::Exception::CUDAError
 
class  BALL::Exception::NoBufferAvailable
 
class  BALL::Exception::FormatUnsupported
 
class  BALL::Exception::NotInitialized
 
class  BALL::Exception::GlobalExceptionHandler
 
class  BALL::Limits< T >
 

Functions

BALL_EXPORT std::ostream & BALL::operator<< (std::ostream &os, const Exception::GeneralException &e)
 
BALL_EXPORT string BALL::streamClassName (const std::type_info &t)
 
#define BALL_CREATE_DEEP(name)
 
#define BALL_CREATE(name)
 
#define BALL_DEFINE_CREATE(name)
 

Detailed Description

This chapter contains all relevant information on very fundamental definitions and classes used throughout BALL (part of the Foundation Classes).

Macro Definition Documentation

#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);\
}

Virtual construction macro. 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

The create method either creates an empty default object of the class (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.
Parameters
namethe class name

Definition at line 62 of file create.h.

#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);\
}

Virtual construction macro. 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

The create method either creates an empty default object of the class (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.
The macro also implements a static method createDefault that returns a void pointer to a new instance of name.
Parameters
namethe class name

Definition at line 26 of file create.h.

#define BALL_DEFINE_CREATE (   name)
Value:
\
virtual void* create(bool deep = true, bool empty = false) const;\
static void* createDefault();

Virtual cloning method definition macro. 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();

Definition at line 93 of file create.h.

Function Documentation

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.

Parameters
tthe type_info structure as returned by typeid
Returns
string the coverted class name