Main Page | Class Hierarchy | Data Structures | File List | Data Fields | Globals

GraphException Class Reference

#include <GraphException.hpp>


Detailed Description

Contains information about the exception thrown.

This should be thrown by using the macro for exception calling:

 throw GraphEx(invalid_node);
 throw GraphExMsg(invalid_node, "custome error message");

Excample for catching an exception:

 try {
   Node no_node = graph->node("i don't exist");
 }
 catch( GraphException &e ) {
   e.print();
 }


Public Types

enum  error {
  undefined, invalid_node, invalid_node_id, duplicate_node_id,
  invalid_edge, invalid_edge_id, duplicate_edge_id, duplicate_id,
  invalid_id, invalid_property, invalid_property_type, cannot_step
}
 Error numbers. More...

Public Member Functions

 GraphException ()
 Empty Constructor.
 GraphException (error e, std::string msg, const int line=0, const char *file=NULL)
 Constructor.
 GraphException (const GraphException &ex)
 Copy Constructor.
virtual ~GraphException ()
 Destructor.
virtual void halt ()
 Print exception and halt program.
virtual void print ()
 Print Exception.
virtual std::string message ()
 Return exception message.
virtual error exception ()
 Return exception type.

Static Public Attributes

static const char * messages []
 Exception messages.

Private Attributes

int e
 The exception.
std::string msg
 A custom message.
int line
 The line in which the exception occured.
const char * file
 The file in which the exception occured.


Member Enumeration Documentation

enum error
 

Error numbers.

Enumeration values:
undefined  Undefined error.
invalid_node  The node was not a valid node.
invalid_node_id  The node id was invalid.
duplicate_node_id  Trying to set an id for a node where the id already existed.
invalid_edge  The edge was not a valid edge.
invalid_edge_id  The edge id was invalid.
duplicate_edge_id  Trying to set an id for an edge where the id already existed.
duplicate_id  Trying to set an id for a node/edge where the id already existed.
invalid_id  The ID was invalid.
invalid_property  The property was invalid.
invalid_property_type  The property type was invalid.
cannot_step  Step failed.


Constructor & Destructor Documentation

GraphException  ) 
 

Empty Constructor.

GraphException error  ex,
std::string  msg,
const int  line = 0,
const char *  file = NULL
 

Constructor.

GraphException const GraphException ex  ) 
 

Copy Constructor.

~GraphException  )  [virtual]
 

Destructor.


Member Function Documentation

GraphException::error exception  )  [virtual]
 

Return exception type.

void halt  )  [virtual]
 

Print exception and halt program.

std::string message  )  [virtual]
 

Return exception message.

void print  )  [virtual]
 

Print Exception.


Field Documentation

int e [private]
 

The exception.

const char* file [private]
 

The file in which the exception occured.

int line [private]
 

The line in which the exception occured.

const char * messages [static]
 

Initial value:

 {
    "Undefined error",
    "Invalid node",
    "Invalid node ID",
    "Trying to set the ID of a node to a value which was already in use",
    "Invalid edge",
    "Invalid edge ID",
    "Trying to set the ID of an edge to a value which was already in use",
    "Trying to set the ID for a node/edge where the id was already in use",
    "Invalid ID",
    "Property does not exist",
    "The property type did not match the type of the new value",
    "Hierarchy: step() failed. Either there were no nodes given, or you were trying to make a deque",
  }
Exception messages.

std::string msg [private]
 

A custom message.


Generated on Sun Nov 5 12:06:23 2006 for Graph by  doxygen 1.4.1