g2o
Classes | Enumerations | Functions
SlamParser Namespace Reference

Classes

class  AbstractSlamInterface
 interface for communicating with the SLAM algorithm More...
 
class  AddEdge
 
class  AddNode
 
class  CommandNode
 
class  Driver
 
class  FixNode
 
class  location
 Abstract a location. More...
 
class  Parser
 A Bison parser. More...
 
class  ParserInterface
 top-level interface to the parser More...
 
class  position
 Abstract a position. More...
 
class  QueryState
 
class  Scanner
 
class  SlamContext
 
class  SlamContextInterface
 
class  slice
 Present a slice of the top of a stack. More...
 
class  SolveSate
 
class  stack
 

Enumerations

enum  CommandType {
  CT_ADD_NODE, CT_ADD_EDGE, CT_SOLVE_STATE, CT_QUERY_STATE,
  CT_FIX
}
 

Functions

const location operator+ (const location &begin, const location &end)
 Join two location objects to create a location. More...
 
const location operator+ (const location &begin, unsigned int width)
 Add two location objects. More...
 
locationoperator+= (location &res, unsigned int width)
 Add and assign a location. More...
 
bool operator== (const location &loc1, const location &loc2)
 Compare two location objects. More...
 
bool operator!= (const location &loc1, const location &loc2)
 Compare two location objects. More...
 
std::ostream & operator<< (std::ostream &ostr, const location &loc)
 Intercept output stream redirection. More...
 
const positionoperator+= (position &res, const int width)
 Add and assign a position. More...
 
const position operator+ (const position &begin, const int width)
 Add two position objects. More...
 
const positionoperator-= (position &res, const int width)
 Add and assign a position. More...
 
const position operator- (const position &begin, const int width)
 Add two position objects. More...
 
bool operator== (const position &pos1, const position &pos2)
 Compare two position objects. More...
 
bool operator!= (const position &pos1, const position &pos2)
 Compare two position objects. More...
 
std::ostream & operator<< (std::ostream &ostr, const position &pos)
 Intercept output stream redirection. More...
 

Enumeration Type Documentation

Enumerator
CT_ADD_NODE 
CT_ADD_EDGE 
CT_SOLVE_STATE 
CT_QUERY_STATE 
CT_FIX 

Definition at line 35 of file commands.h.

Function Documentation

bool SlamParser::operator!= ( const location loc1,
const location loc2 
)
inline

Compare two location objects.

Definition at line 136 of file location.hh.

137  {
138  return !(loc1 == loc2);
139  }
bool SlamParser::operator!= ( const position pos1,
const position pos2 
)
inline

Compare two position objects.

Definition at line 142 of file position.hh.

143  {
144  return !(pos1 == pos2);
145  }
const location SlamParser::operator+ ( const location begin,
const location end 
)
inline

Join two location objects to create a location.

Definition at line 105 of file location.hh.

References SlamParser::location::begin, and SlamParser::location::end.

106  {
107  location res = begin;
108  res.end = end.end;
109  return res;
110  }
const position SlamParser::operator+ ( const position begin,
const int  width 
)
inline

Add two position objects.

Definition at line 110 of file position.hh.

111  {
112  position res = begin;
113  return res += width;
114  }
const location SlamParser::operator+ ( const location begin,
unsigned int  width 
)
inline

Add two location objects.

Definition at line 113 of file location.hh.

References SlamParser::location::begin, and SlamParser::location::columns().

114  {
115  location res = begin;
116  res.columns (width);
117  return res;
118  }
const position& SlamParser::operator+= ( position res,
const int  width 
)
inline

Add and assign a position.

Definition at line 102 of file position.hh.

103  {
104  res.columns (width);
105  return res;
106  }
location& SlamParser::operator+= ( location res,
unsigned int  width 
)
inline

Add and assign a location.

Definition at line 121 of file location.hh.

References SlamParser::location::columns().

122  {
123  res.columns (width);
124  return res;
125  }
const position SlamParser::operator- ( const position begin,
const int  width 
)
inline

Add two position objects.

Definition at line 125 of file position.hh.

126  {
127  return begin + -width;
128  }
const position& SlamParser::operator-= ( position res,
const int  width 
)
inline

Add and assign a position.

Definition at line 118 of file position.hh.

119  {
120  return res += -width;
121  }
std::ostream& SlamParser::operator<< ( std::ostream &  ostr,
const location loc 
)
inline

Intercept output stream redirection.

Parameters
ostrthe destination output stream
loca reference to the location to redirect

Avoid duplicate information.

Definition at line 147 of file location.hh.

References SlamParser::location::begin, SlamParser::position::column, SlamParser::location::end, SlamParser::position::filename, and SlamParser::position::line.

148  {
149  position last = loc.end - 1;
150  ostr << loc.begin;
151  if (last.filename
152  && (!loc.begin.filename
153  || *loc.begin.filename != *last.filename))
154  ostr << '-' << last;
155  else if (loc.begin.line != last.line)
156  ostr << '-' << last.line << '.' << last.column;
157  else if (loc.begin.column != last.column)
158  ostr << '-' << last.column;
159  return ostr;
160  }
std::ostream& SlamParser::operator<< ( std::ostream &  ostr,
const position pos 
)
inline

Intercept output stream redirection.

Parameters
ostrthe destination output stream
posa reference to the position to redirect

Definition at line 152 of file position.hh.

153  {
154  if (pos.filename)
155  ostr << *pos.filename << ':';
156  return ostr << pos.line << '.' << pos.column;
157  }
bool SlamParser::operator== ( const location loc1,
const location loc2 
)
inline

Compare two location objects.

Definition at line 129 of file location.hh.

References SlamParser::location::begin, and SlamParser::location::end.

130  {
131  return loc1.begin == loc2.begin && loc1.end == loc2.end;
132  }
bool SlamParser::operator== ( const position pos1,
const position pos2 
)
inline

Compare two position objects.

Definition at line 132 of file position.hh.

133  {
134  return
135  (pos1.filename == pos2.filename
136  || (pos1.filename && pos2.filename && *pos1.filename == *pos2.filename))
137  && pos1.line == pos2.line && pos1.column == pos2.column;
138  }