IMP logo
Public Member Functions
RMF::FileConstHandle Class Reference

Detailed Description

A handle for a read-only RMF file.

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

+ Inheritance diagram for RMF::FileConstHandle:

List of all members.

Public Member Functions

 FileConstHandle ()
 Empty root handle, no open file.
template<class T >
void add_associated_data (int index, const T &t)
void flush ()
template<class T >
get_associated_data (int index)
bool get_has_associated_data (int index)
std::string get_name () const
template<class T >
NodeConstHandle get_node_from_association (const T &d) const
NodeConstHandle get_node_from_id (NodeID id) const
NodePairConstHandles get_node_pairs () const
NodeQuadConstHandles get_node_quads () const
template<int Arity>
vector< NodeSetConstHandle
< Arity > > 
get_node_sets () const
NodeTripletConstHandles get_node_triplets () const
unsigned int get_number_of_frames () const
unsigned int get_number_of_node_pairs () const
unsigned int get_number_of_node_quads () const
template<int Arity>
unsigned int get_number_of_node_sets () const
unsigned int get_number_of_node_triplets () const
NodeConstHandle get_root_node () const
 Return the root of the hierarchy.
 operator Showable () const
void show (std::ostream &out) const

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 TypeT , int Arity>
Key< TypeT, Arity > get_key (CategoryD< Arity > category_id, std::string name, bool per_frame) const
template<class TypeT , int Arity>
bool get_has_key (CategoryD< Arity > category_id, std::string name, bool per_frame) const
template<class TypeT , int Arity>
vector< Key< TypeT, Arity > > get_keys (CategoryD< Arity > category_id) const

Non-template versions for python

Type is one of the standard types an arity is one of the empty string (for single nodes), pair, triplet or quad.

ArityTypeKey get_type_key (ArityCategory category_id, std::string nm, bool per_frame) const
bool get_has_type_key (ArityCategory category_id, std::string nm, bool per_frame) const
std::string get_name (ArityTypeKey k) const
ArityCategory get_category (ArityTypeKey k) const
ArityTypeKeys get_type_keys (ArityCategory category_id) const
bool get_is_per_frame (ArityTypeKey k) const

Python only

The following methods are only available in python.

PythonList get_keys (Category c, int arity=1) const
 Return a list with all the keys from that category.
PythonList get_node_sets (int arity) const
 Return all sets of that arity.

Descriptions

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 get_description () const

Key categories template methods

Methods for managing the key categories in this RMF.

template<int Arity>
bool get_has_category (std::string name) const
template<int Arity>
CategoryD< Arity > get_category (std::string name) const
template<int Arity>
vector< CategoryD< Arity > > get_categories () const
template<int Arity>
std::string get_category_name (CategoryD< Arity > kc) const

Key categories non-template methods

We also provide non-template methods for use in Python or environments where templates are not convenient. Arity is one of the empty string, pair, triplet, or quad.

bool get_has_arity_category (std::string name) const
ArityCategory get_arity_category (std::string name) const
std::string get_name (ArityCategory kc) const
ArityCategories get_arity_categories () const
std::string get_prefixcategory_name (ArityCategory kc) const

Constructor & Destructor Documentation

RMF::FileConstHandle::FileConstHandle ( )

Empty root handle, no open file.


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.

void RMF::FileConstHandle::flush ( )

Make sure all data gets written to disk. Once flush is called, it should be safe to open the file in another process for reading.

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

To get back the ith user data.

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

To get back the ith user data.

template<class TypeT , int Arity>
Key<TypeT, Arity> RMF::FileConstHandle::get_key ( CategoryD< Arity >  category_id,
std::string  name,
bool  per_frame 
) const

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

template<class TypeT , int Arity>
vector<Key<TypeT, Arity> > RMF::FileConstHandle::get_keys ( CategoryD< Arity >  category_id) const

Get a list of all keys of the given type,

PythonList RMF::FileConstHandle::get_keys ( Category  c,
int  arity = 1 
) const

Return a list with all the keys from that category.

If arity>1 then the keys for the appropriate sets are returned.

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.

Reimplemented in RMF::FileHandle.

PythonList RMF::FileConstHandle::get_node_sets ( int  arity) const

Return all sets of that arity.

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

Return the number of frames in the file. Currently, this is the number of frames that the x-coordinate has, but it should be made more general.

NodeConstHandle RMF::FileConstHandle::get_root_node ( ) const

Return the root of the hierarchy.

Reimplemented in RMF::FileHandle.


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

Generated on Tue May 22 2012 23:33:38 for IMP by doxygen 1.8.1