RMF
RMF::FileConstHandle Class Reference

A handle for a read-only RMF file. More...

#include <RMF/FileConstHandle.h>

+ Inheritance diagram for RMF::FileConstHandle:

Public Member Functions

 FileConstHandle ()
 Empty root handle, no open file.
 
template<class T >
void add_associated_data (int index, const T &t)
 
void close ()
 Explicitly close the file handle. More...
 
template<class T >
get_associated_data (int index)
 
std::string get_description () const
 
bool get_has_associated_data (int index)
 
bool get_is_closed () const
 Return True iff the file is closed.
 
std::string get_name () const
 
NodeConstHandle get_node (NodeID id) const
 
template<class T >
NodeConstHandle get_node_from_association (const T &d) const
 
std::string get_path () const
 
std::string get_producer () const
 
NodeConstHandle get_root_node () const
 Return the root of the hierarchy.
 
void reload ()
 Reread the file. More...
 

Protected Attributes

std::shared_ptr
< internal::SharedData > 
shared_
 

Friends

void clone_file_info (FileConstHandle, FileHandle)
 
void clone_hierarchy (FileConstHandle, FileHandle)
 
void clone_loaded_frame (FileConstHandle, FileHandle)
 
void clone_static_frame (FileConstHandle, FileHandle)
 
bool get_equal_current_values (FileConstHandle, FileConstHandle)
 
bool get_equal_static_values (FileConstHandle, FileConstHandle)
 

Methods for manipulating keys

When using C++ it is most convenient to specify types when adding and using keys through template arguments. For python we provide non-template versions, below.

template<class Tag >
ID< Tag > get_key (Category category, std::string name) const
 
template<class Tag >
std::vector< ID< Tag > > get_keys (Category category_id, const Strings &names) const
 
template<class Tag >
std::vector< ID< Tag > > get_keys (Category category) const
 
template<class Tag >
ID< Tag > get_key (Category category_id, std::string nm, Tag) const
 
template<class Tag >
std::string get_name (ID< Tag > k) const
 
template<class Tag >
Category get_category (ID< Tag > k) const
 
template<class Tag >
std::vector< ID< Tag > > get_keys (Category category_id, Tag)
 
FrameID get_current_frame () const
 
FrameType get_type (FrameID fr) const
 
std::string get_name (FrameID fr) const
 
FrameIDs get_children (FrameID id) const
 
FrameIDs get_parents (FrameID id) const
 
void set_current_frame (FrameID frame) const
 
unsigned int get_number_of_frames () const
 
unsigned int get_number_of_nodes () const
 
std::string get_file_type () const
 
FrameIDs get_root_frames () const
 
boost::iterator_range
< internal::integer_iterator
< FrameID > > 
get_frames () const
 
boost::iterator_range
< internal::integer_iterator
< NodeID > > 
get_node_ids () const
 

Python only

The following methods are only available in python.

PythonList get_keys (Category c) const
 Return a list with all the keys from that category.
 

Key categories methods

Methods for managing the key categories in this RMF.

Category get_category (std::string name)
 
Categories get_categories () const
 
std::string get_name (Category kc) const
 

Detailed Description

Use this handle to perform operations relevant to the whole RMF hierarchy as well as to start traversal of the hierarchy.

See Also
open_rmf_file_read_only
Examples:
benchmark/benchmark_rmf.cpp.

Definition at line 78 of file FileConstHandle.h.

Member Function Documentation

template<class T >
void RMF::FileConstHandle::add_associated_data ( int  index,
const T &  t 
)

Along with the associations for nodes, arbitrary data can be associated with the file in memory to aid in processing.

Definition at line 338 of file FileConstHandle.h.

void RMF::FileConstHandle::close ( )

Normally, an RMF file is automatically closed when this handle object goes out of scope. If closed with this method, any further operations on this handle will raise an error. Trying to close a file that is already closed will do nothing.

Examples:
benchmark/benchmark_rmf.cpp.

Definition at line 130 of file FileConstHandle.h.

template<class T >
T RMF::FileConstHandle::get_associated_data ( int  index)

To get back the ith user data.

Definition at line 343 of file FileConstHandle.h.

Categories RMF::FileConstHandle::get_categories ( ) const

This returns all the categories that are used in the current frame. Other frames may have different ones.

Definition at line 377 of file FileConstHandle.h.

FrameID RMF::FileConstHandle::get_current_frame ( ) const

The file always has a single frame that is currently active at any given point.

Definition at line 222 of file FileConstHandle.h.

std::string RMF::FileConstHandle::get_description ( ) const

Each RMF structure has an associated description. This should consist of unstructured text describing the contents of the RMF data. Conventionally. this description can consist of multiple paragraphs, each separated by a newline character and should end in a newline.

std::string RMF::FileConstHandle::get_file_type ( ) const

Return a string identifying the file type.

Definition at line 279 of file FileConstHandle.h.

bool RMF::FileConstHandle::get_has_associated_data ( int  index)

To get back the ith user data.

Definition at line 348 of file FileConstHandle.h.

template<class Tag >
ID<Tag> RMF::FileConstHandle::get_key ( Category  category,
std::string  name 
) const

Get an existing key that has the given name of the given type or Key() if the key is not found.

Definition at line 159 of file FileConstHandle.h.

template<class Tag >
std::vector<ID<Tag> > RMF::FileConstHandle::get_keys ( Category  category) const

Get a list of all keys of the given type,

Definition at line 186 of file FileConstHandle.h.

template<class Tag >
std::vector<ID<Tag> > RMF::FileConstHandle::get_keys ( Category  category_id,
Tag   
)

This returns all the keys that are used in the current frame. \ Other frames may have different ones.

Definition at line 212 of file FileConstHandle.h.

template<class T >
NodeConstHandle RMF::FileConstHandle::get_node_from_association ( const T &  d) const

Each node in the hierarchy can be associated with some arbitrary bit of external data. Nodes can be extracted using these bits of data.

Definition at line 322 of file FileConstHandle.h.

unsigned int RMF::FileConstHandle::get_number_of_frames ( ) const

Return the number of frames in the file.

Definition at line 259 of file FileConstHandle.h.

unsigned int RMF::FileConstHandle::get_number_of_nodes ( ) const

Return the number of nodes in the file.

Definition at line 269 of file FileConstHandle.h.

std::string RMF::FileConstHandle::get_producer ( ) const

Each RMF structure has an associated field that the code that produced the file can use to describe itself.

FrameIDs RMF::FileConstHandle::get_root_frames ( ) const

Get all the frames that are roots (aren't subframes).

void RMF::FileConstHandle::reload ( )
Note
This may invalidate various things (e.g. the number of nodes may vary). Be careful.

Friends And Related Function Documentation

void clone_file_info ( FileConstHandle  ,
FileHandle   
)
friend

Copy the hierarchy structure and set structure from one RMF file to another.

void clone_hierarchy ( FileConstHandle  ,
FileHandle   
)
friend

Copy the hierarchy structure and set structure from one RMF file to another.

void clone_loaded_frame ( FileConstHandle  ,
FileHandle   
)
friend

Copy the data of a single frame from between two files.

void clone_static_frame ( FileConstHandle  ,
FileHandle   
)
friend

Copy the data of a single frame from between two files. Parts missing in the output file will be skipped.

bool get_equal_current_values ( FileConstHandle  ,
FileConstHandle   
)
friend

Return true of the two have the same values in the current frame.

bool get_equal_static_values ( FileConstHandle  ,
FileConstHandle   
)
friend

Return true if the two have the same values in the static frame.


The documentation for this class was generated from the following file: