MRPT logo

mrpt::slam::CRawlogXXL Class Reference

This class is identical to slam::CRawlog but it transparently manages the dump of objects to a temporary file in disk, so it can handle very large rawlogs that otherwise don't fit in memory (EXPERIMENTAL, DO NOT USE!!!!). More...

#include <mrpt/slam/CRawlogXXL.h>

Inheritance diagram for mrpt::slam::CRawlogXXL:

mrpt::utils::CSerializable mrpt::utils::CUncopiable

List of all members.

Classes

class  const_iterator
 A normal const iterator, plus the extra methods to determine the type of each entry in the sequence. More...
class  iterator
 A normal iterator, plus the extra methods to determine the type of each entry in the sequence. More...
struct  TObjectElementXXL

Public Types

enum  TEntryType { etSensoryFrame = 0, etActionCollection, etObservation }
 The type of each entry in a rawlog. More...

Public Member Functions

bool isOK ()
 Whether the temporary swap file has been opened correctly.
 CRawlogXXL ()
 Default constructor:.
virtual ~CRawlogXXL ()
 Copy operator:.
void clear ()
 Clear the sequence of actions/observations, freeing the memory of all the objects in the list.
void clearWithoutDelete ()
 Clear the sequence of actions/observations, without deleting the objects themselves (USE ONLY IF YOU KNOW WHAT YOU DO, NORMALLY YOU'LL CALL "clear" INSTEAD).
void addAction (CAction &action)
 Add an action to the sequence: a collection of just one element is created.
void addActions (CActionCollection &action)
 Add a set of actions to the sequence; the object is duplicated, so the original one can be free if desired.
void addObservations (CSensoryFrame &observations)
 Add a set of observations to the sequence; the object is duplicated, so the original one can be free if desired.
void addActionsMemoryReference (const CActionCollectionPtr &action)
 Add a set of actions to the sequence, using a smart pointer to the object to add.
void addObservationsMemoryReference (const CSensoryFramePtr &observations)
 Add a set of observations to the sequence, using a smart pointer to the object to add.
void addObservationMemoryReference (const CObservationPtr &observation)
 Add a single observation to the sequence, using a smart pointer to the object to add.
bool loadFromRawLogFile (const std::string &fileName)
 Load the contents from a file containing one of these possibilities:
  • A "CRawlogXXL" object.

size_t size ()
 Returns the number of actions / observations object in the sequence.
MRPT_DEPRECATED_PRE bool isAction (size_t index) MRPT_DEPRECATED_POST
 Returns true if the given object is an action, or false if it is a set of observations, where index=0 is the first object.
TEntryType getType (size_t index) const
 Returns the type of a given element.
void remove (size_t index)
 Delete the action or observation stored in the given index.
CActionCollectionPtr getAsAction (size_t index)
 Returns the i'th element in the sequence, as being actions, where index=0 is the first object.
CSensoryFramePtr getAsObservations (size_t index)
 Returns the i'th element in the sequence, as being an action, where index=0 is the first object.
CSerializablePtr getAsGeneric (size_t index)
 Returns the i'th element in the sequence, being its class whatever.
CObservationPtr getAsObservation (size_t index)
 Returns the i'th element in the sequence, as being an observation, where index=0 is the first object.
const_iterator begin () const
iterator begin ()
const_iterator end () const
iterator end ()
iterator remove (const iterator &it)
void moveFrom (CRawlogXXL &obj)
 Efficiently copy the contents from other existing object, and remove the data from the origin (after calling this, the original object will have no actions/observations).
void swap (CRawlogXXL &obj)
 Efficiently swap the contents of two existing objects.

Private Types

typedef std::deque
< TObjectElementXXL
TListObjects

Private Member Functions

void assureElementIsLoaded (size_t index, bool swapOutOldEntries=true)
 If the given objects is not in memory, bring it back from disk (and possibly send others to disk).
void swapEntryToDisk (size_t index)
 Swap entry to disk.
void swapEntriesToDiskIfRequired (const TTimeStamp tnow)
 Swap entries out to disk if required.

Private Attributes

TListObjects m_seqOfActObs
 The list where the objects really are in.
mrpt::utils::CFileStream m_tempFile
 The file with the "disk-swapped" objects.
size_t m_objectsInMemory
 How many objects are actually in memory instead of the swap file.

Static Private Attributes

static const size_t INVALID_POS


Detailed Description

This class is identical to slam::CRawlog but it transparently manages the dump of objects to a temporary file in disk, so it can handle very large rawlogs that otherwise don't fit in memory (EXPERIMENTAL, DO NOT USE!!!!).

By default, this class behaves like CRawlog, until the amount of memory used by the current proccess reaches a given limit indicated in the constructor.

See also:
CRawlog

Definition at line 49 of file CRawlogXXL.h.


Member Typedef Documentation

Definition at line 69 of file CRawlogXXL.h.


Member Enumeration Documentation

The type of each entry in a rawlog.

See also:
CRawlogXXL::getType
Enumerator:
etSensoryFrame 
etActionCollection 
etObservation 

Definition at line 93 of file CRawlogXXL.h.


Constructor & Destructor Documentation

mrpt::slam::CRawlogXXL::CRawlogXXL (  ) 

Default constructor:.

virtual mrpt::slam::CRawlogXXL::~CRawlogXXL (  )  [virtual]

Copy operator:.

See also:
moveFrom Destructor:


Member Function Documentation

void mrpt::slam::CRawlogXXL::addAction ( CAction action  ) 

Add an action to the sequence: a collection of just one element is created.

The object is duplicated, so the original one can be free if desired.

void mrpt::slam::CRawlogXXL::addActions ( CActionCollection action  ) 

Add a set of actions to the sequence; the object is duplicated, so the original one can be free if desired.

See also:
addObservations, addActionsMemoryReference

void mrpt::slam::CRawlogXXL::addActionsMemoryReference ( const CActionCollectionPtr &  action  ) 

Add a set of actions to the sequence, using a smart pointer to the object to add.

See also:
addActions, addObservationsMemoryReference, addObservationMemoryReference

void mrpt::slam::CRawlogXXL::addObservationMemoryReference ( const CObservationPtr &  observation  ) 

Add a single observation to the sequence, using a smart pointer to the object to add.

See also:
addObservations, addActionsMemoryReference

void mrpt::slam::CRawlogXXL::addObservations ( CSensoryFrame observations  ) 

Add a set of observations to the sequence; the object is duplicated, so the original one can be free if desired.

See also:
addActions, addObservationsMemoryReference

void mrpt::slam::CRawlogXXL::addObservationsMemoryReference ( const CSensoryFramePtr &  observations  ) 

Add a set of observations to the sequence, using a smart pointer to the object to add.

See also:
addObservations, addActionsMemoryReference, addObservationMemoryReference

void mrpt::slam::CRawlogXXL::assureElementIsLoaded ( size_t  index,
bool  swapOutOldEntries = true 
) [private]

If the given objects is not in memory, bring it back from disk (and possibly send others to disk).

iterator mrpt::slam::CRawlogXXL::begin (  )  [inline]

Definition at line 309 of file CRawlogXXL.h.

const_iterator mrpt::slam::CRawlogXXL::begin (  )  const [inline]

Definition at line 308 of file CRawlogXXL.h.

void mrpt::slam::CRawlogXXL::clear (  ) 

Clear the sequence of actions/observations, freeing the memory of all the objects in the list.

void mrpt::slam::CRawlogXXL::clearWithoutDelete (  ) 

Clear the sequence of actions/observations, without deleting the objects themselves (USE ONLY IF YOU KNOW WHAT YOU DO, NORMALLY YOU'LL CALL "clear" INSTEAD).

iterator mrpt::slam::CRawlogXXL::end (  )  [inline]

Definition at line 311 of file CRawlogXXL.h.

const_iterator mrpt::slam::CRawlogXXL::end (  )  const [inline]

Definition at line 310 of file CRawlogXXL.h.

CActionCollectionPtr mrpt::slam::CRawlogXXL::getAsAction ( size_t  index  ) 

Returns the i'th element in the sequence, as being actions, where index=0 is the first object.

If it is not a CActionCollection, it throws an exception. Do neighter modify nor delete the returned pointer.

See also:
size, isAction, getAsObservations, getAsObservation
Exceptions:
std::exception If index is out of bounds

CSerializablePtr mrpt::slam::CRawlogXXL::getAsGeneric ( size_t  index  ) 

Returns the i'th element in the sequence, being its class whatever.

See also:
size, isAction, getAsAction, getAsObservations
Exceptions:
std::exception If index is out of bounds

CObservationPtr mrpt::slam::CRawlogXXL::getAsObservation ( size_t  index  ) 

Returns the i'th element in the sequence, as being an observation, where index=0 is the first object.

If it is not an CObservation, it throws an exception. Do neighter modify nor delete the returned pointer. This is the proper method to obtain the objects stored in a "only observations"-rawlog file (named "format #2" above.

See also:
size, isAction, getAsAction
Exceptions:
std::exception If index is out of bounds

CSensoryFramePtr mrpt::slam::CRawlogXXL::getAsObservations ( size_t  index  ) 

Returns the i'th element in the sequence, as being an action, where index=0 is the first object.

If it is not an CSensoryFrame, it throws an exception. Do neighter modify nor delete the returned pointer.

See also:
size, isAction, getAsAction, getAsObservation
Exceptions:
std::exception If index is out of bounds

TEntryType mrpt::slam::CRawlogXXL::getType ( size_t  index  )  const

Returns the type of a given element.

See also:
isAction, isObservation

MRPT_DEPRECATED_PRE bool mrpt::slam::CRawlogXXL::isAction ( size_t  index  ) 

Returns true if the given object is an action, or false if it is a set of observations, where index=0 is the first object.

See also:
size, getAsAction, getAsObservations
Exceptions:
std::exception If index is out of bounds

bool mrpt::slam::CRawlogXXL::isOK (  ) 

Whether the temporary swap file has been opened correctly.

bool mrpt::slam::CRawlogXXL::loadFromRawLogFile ( const std::string &  fileName  ) 

Load the contents from a file containing one of these possibilities:

  • A "CRawlogXXL" object.

  • Directly "CSensoryFrame" and "CActionCollection" objects. In this case the method stops reading on EOF of an unrecogniced class name.
    Returns:
    It returns false if the file does not exists.

void mrpt::slam::CRawlogXXL::moveFrom ( CRawlogXXL obj  ) 

Efficiently copy the contents from other existing object, and remove the data from the origin (after calling this, the original object will have no actions/observations).

iterator mrpt::slam::CRawlogXXL::remove ( const iterator it  ) 

void mrpt::slam::CRawlogXXL::remove ( size_t  index  ) 

Delete the action or observation stored in the given index.

Exceptions:
std::exception If index is out of bounds

size_t mrpt::slam::CRawlogXXL::size (  ) 

Returns the number of actions / observations object in the sequence.

void mrpt::slam::CRawlogXXL::swap ( CRawlogXXL obj  ) 

Efficiently swap the contents of two existing objects.

void mrpt::slam::CRawlogXXL::swapEntriesToDiskIfRequired ( const TTimeStamp  tnow  )  [private]

Swap entries out to disk if required.

void mrpt::slam::CRawlogXXL::swapEntryToDisk ( size_t  index  )  [private]

Swap entry to disk.


Member Data Documentation

const size_t mrpt::slam::CRawlogXXL::INVALID_POS [static, private]

Definition at line 57 of file CRawlogXXL.h.

How many objects are actually in memory instead of the swap file.

Definition at line 74 of file CRawlogXXL.h.

The list where the objects really are in.

Definition at line 70 of file CRawlogXXL.h.

The file with the "disk-swapped" objects.

Definition at line 72 of file CRawlogXXL.h.




Page generated by Doxygen 1.5.8 for MRPT 0.6.5 SVN: at Sun Aug 9 21:47:23 CEST 2009