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.
template<class T>
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.

Protected Attributes

std::shared_ptr< internal::SharedData > shared_

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.

Constructor & Destructor Documentation

◆ FileConstHandle()

RMF::FileConstHandle::FileConstHandle ( )

Definition at line 109 of file FileConstHandle.h.

Member Function Documentation

◆ add_associated_data()

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.

◆ close()

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.

Here is the call graph for this function:

◆ get_associated_data()

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.

◆ get_categories()

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.

◆ get_category() [1/2]

template<class Tag>
Category RMF::FileConstHandle::get_category ( ID< Tag > k) const

Definition at line 206 of file FileConstHandle.h.

◆ get_category() [2/2]

Category RMF::FileConstHandle::get_category ( std::string name)

Definition at line 369 of file FileConstHandle.h.

◆ get_children()

FrameIDs RMF::FileConstHandle::get_children ( FrameID id) const

Definition at line 235 of file FileConstHandle.h.

◆ get_current_frame()

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.

Here is the call graph for this function:

◆ get_description()

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.

◆ get_file_type()

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

Return a string identifying the file type.

Definition at line 279 of file FileConstHandle.h.

Here is the call graph for this function:

◆ get_frames()

boost::iterator_range< internal::integer_iterator< FrameID > > RMF::FileConstHandle::get_frames ( ) const
Examples
benchmark/benchmark_rmf.cpp.

Definition at line 288 of file FileConstHandle.h.

◆ get_has_associated_data()

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

To get back the ith user data.

Definition at line 348 of file FileConstHandle.h.

◆ get_is_closed()

bool RMF::FileConstHandle::get_is_closed ( ) const

Definition at line 121 of file FileConstHandle.h.

◆ get_key() [1/2]

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.

◆ get_key() [2/2]

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

Definition at line 195 of file FileConstHandle.h.

◆ get_keys() [1/3]

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.

◆ get_keys() [2/3]

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

Definition at line 167 of file FileConstHandle.h.

◆ get_keys() [3/3]

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.

◆ get_name() [1/4]

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

Definition at line 136 of file FileConstHandle.h.

◆ get_name() [2/4]

std::string RMF::FileConstHandle::get_name ( Category kc) const

Definition at line 383 of file FileConstHandle.h.

◆ get_name() [3/4]

std::string RMF::FileConstHandle::get_name ( FrameID fr) const

Definition at line 231 of file FileConstHandle.h.

◆ get_name() [4/4]

template<class Tag>
std::string RMF::FileConstHandle::get_name ( ID< Tag > k) const

Definition at line 199 of file FileConstHandle.h.

◆ get_node_from_association()

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.

◆ get_node_ids()

boost::iterator_range< internal::integer_iterator< NodeID > > RMF::FileConstHandle::get_node_ids ( ) const
Examples
benchmark/benchmark_rmf.cpp.

Definition at line 293 of file FileConstHandle.h.

◆ get_number_of_frames()

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.

Here is the call graph for this function:

◆ get_number_of_nodes()

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.

Here is the call graph for this function:

◆ get_parents()

FrameIDs RMF::FileConstHandle::get_parents ( FrameID id) const

Definition at line 240 of file FileConstHandle.h.

◆ get_path()

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

Definition at line 144 of file FileConstHandle.h.

◆ get_producer()

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.

◆ get_root_frames()

FrameIDs RMF::FileConstHandle::get_root_frames ( ) const

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

◆ get_root_node()

NodeConstHandle RMF::FileConstHandle::get_root_node ( ) const
Examples
benchmark/benchmark_rmf.cpp.

Definition at line 115 of file FileConstHandle.h.

Here is the call graph for this function:

◆ get_type()

FrameType RMF::FileConstHandle::get_type ( FrameID fr) const

Definition at line 227 of file FileConstHandle.h.

◆ reload()

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

◆ set_current_frame()

void RMF::FileConstHandle::set_current_frame ( FrameID frame) const
Examples
benchmark/benchmark_rmf.cpp.

Definition at line 245 of file FileConstHandle.h.

Member Data Documentation

◆ shared_

std::shared_ptr<internal::SharedData> RMF::FileConstHandle::shared_
protected

Definition at line 102 of file FileConstHandle.h.


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