Пример #1
0
 object::object(object::data* derived)
     : _data()
 {
     if (derived != buffer())
         throw bad_data();
     _data = derived;
 }
Пример #2
0
long 
stmtNumData::numStmt(nast_code code)
  throw (bad_data)
{ 
  if ( (isStmt(code)) || (isOthrStmt(code)) || (code == CASE_LABEL) )
    return counted[code]; 
  else 
    throw bad_data("stmtNumData",
		   "Impossibile get the number of a stmt_n");
}
Пример #3
0
// ---------------------------------------------------------------------------
//  CLASS
// ---------------------------------------------------------------------------
void 
stmtNumData::addStmt(nast_code code)
  throw (bad_data)
{ 
  if ( (isStmt(code)) || (isOthrStmt(code)) || (code == CASE_LABEL) )
    counted[code]++; 
  else 
    throw bad_data("stmtNumData",
		   "Impossibile add a new stmt_n");
  return;
}
Пример #4
0
node *
graphData::nextNode(void) 
  throw (bad_data)
{
  // is there a next node ?
  if ( graphData::hasNextNode() ) {

    pNodesL_pos++;
    pNodesL++;
    return *pNodesL;

  } 
  else 
    throw bad_data("graphData::nextNode",
		   "The next node doesn't exsist");
}
Пример #5
0
node *
graphData::firstNode (void) 
  throw (bad_data)
{

  // is the list empty ?
  if ( nodesL.size() ) {
    pNodesL_pos = 1;
    pNodesL = nodesL.begin();
    
    return *pNodesL;
  } 
  else 
    throw bad_data("graphData::firstNode",
		   "The first node don't exsist");
}
Пример #6
0
//---- Members
void 
graphData::addNode(int id, char *name, int c)
  throw (bad_data) 
{
  node                          *n;     // a new node

  // Checks the precondition
  if (graphData::hasNode(id)) 
    throw bad_data("graphData::addNode",
		   "Duplicate node ! Impossibile add the node " +
		   a2b::long2string(id));
  else {
    n = new node;
    n->id = id;
    n->name = name;
    n->c = c;
    nodesL.push_back(n);
    nodesNum++;
  }

  return;
}
Пример #7
0
string 
graphData::getNodeName(int id) 
  throw (bad_data)
{
  string                        name;   // the name of the node
  list <node *>::iterator       p;      // browse the list
  node                          *n;     // a node
  bool                          build;  // flag for building the name

  build = false;
  for (p = nodesL.begin();(p != nodesL.end()) && (!build); p++) {
    n = *p;
    if ( build = (n->id == id) ) 
      name = n->name; 
  }
 
  if (!build) 
    throw bad_data("graphData::getNodeName",
		   "Can't build the name of a node.");
  
  return name;
}