Structural Bioinformatics Library
Template C++ / Python API for developping structural bioinformatics applications.
Generic_classifier< Properties_ > Struct Template Reference

#include <atom_classifier.h>

Public Member Functions

 Generic_classifier ()
 
 Generic_classifier (std::string filename, int)
 
 Generic_classifier (const std::string &filename)
 
const Properties & get_properties (unsigned i) const
 
const Properties & get_properties (const Query_type &query) const
 
unsigned number_of_properties () const
 
Properties_iterator properties_begin ()
 
Properties_const_iterator properties_begin () const
 
Properties_iterator properties_end ()
 
Properties_const_iterator properties_end () const
 

Detailed Description

template<class Properties_>
struct ESBTL::Generic_classifier< Properties_ >

An object that help to associate properties to objects. This can be used for example to to associate a radius or a color to an (pseudo-)atom type.

Template Parameters
Properties_must follow the concept of Property class.

Constructor & Destructor Documentation

◆ Generic_classifier() [1/3]

Generic_classifier ( )
inline

Default constructor. The method Properties_::default_loader is called to fill in the dictionary and the property vector.

◆ Generic_classifier() [2/3]

Generic_classifier ( std::string  filename,
int   
)
inline

Constructor that uses a file to complete the default properties. Not yet implemented

◆ Generic_classifier() [3/3]

Generic_classifier ( const std::string &  filename)
inline

Constructor using a file, default is not loaded. The file must follow the following format:

EXTRA
...
END
CLASSIFICATION
... i
END
PROPERTIES
0 ...
... ...
n ...
END
DEFAULT
i
END

There are four different sections providing different kind of information:

  • EXTRA: For each line of the file, the function Properties_::handle_extra is called.
  • CLASSIFICATION: This section contains information to associate an object to an index. For each line of the file, the function Properties_::add_classification is called.
  • PROPERTIES: This section contains the properties. It must start by the index of the property followed by the information required to define the property. For each line of the file, a property is constructed using the constructor with a string stream and an unsigned integer. The property index is first extracted and the rest of the line is put into a string stream.
  • DEFAULT: This section defines the index of the default property (if needed).

Note that none of these sections are mandatory.

Member Function Documentation

◆ get_properties() [1/2]

const Properties& get_properties ( const Query_type &  query) const
inline

Returns a property associated to a Query_type object.

Parameters
queryis the object a property is looking for in the dictionary.

◆ get_properties() [2/2]

const Properties& get_properties ( unsigned  i) const
inline

Returns a property given its index

Parameters
iis the index of the desired property (starting from 0).

◆ number_of_properties()

unsigned number_of_properties ( ) const
inline

returns the number of properties.

◆ properties_begin() [1/2]

Properties_iterator properties_begin ( )
inline

Returns the first iterator on properties.

◆ properties_begin() [2/2]

Properties_const_iterator properties_begin ( ) const
inline

Returns the first iterator on properties, const version.

◆ properties_end() [1/2]

Properties_iterator properties_end ( )
inline

Returns the past-end iterator on properties.

◆ properties_end() [2/2]

Properties_const_iterator properties_end ( ) const
inline

Returns the past-end iterator on properties, const version.