IMP
2.0.1
The Integrative Modeling Platform
|
See IMP.base Overview for more information.
Classes | |
struct | AddBoolFlag |
struct | AddFloatFlag |
struct | AddIntFlag |
struct | AddStringFlag |
class | Array |
A class to store an fixed array of same-typed values. More... | |
class | ConstVector |
Store an array of values of the same type. More... | |
class | CreateLogContext |
Create a new log context. More... | |
class | EventException |
An exception that signifies some event occurred. More... | |
class | Exception |
The general base class for IMP exceptions. More... | |
class | Index |
class | IndexException |
An exception for a request for an invalid member of a container. More... | |
class | IndexVector |
class | InputAdaptor |
struct | InternalException |
A general exception for an intenal error in IMP. More... | |
class | IOException |
An input/output exception. More... | |
class | LRUCache |
class | map |
class | Memoizer |
class | ModelException |
An exception which is thrown when the Model has attributes with invalid values. More... | |
class | NonCopyable |
class | Object |
Common base class for heavy weight IMP objects. More... | |
struct | OwnerPointer |
A reference counted pointer to an Object. More... | |
class | piecewise_linear_distribution |
struct | Pointer |
A reference counted pointer to an object. More... | |
class | RAII |
class | RefCounted |
Common base class for ref counted objects. More... | |
class | set |
class | SetCheckState |
A class to change and restore check state. More... | |
class | SetLogState |
A class to change and restore log state. More... | |
class | SetLogTarget |
class | SetNumberOfThreads |
class | Showable |
class | SparseSymmetricPairMemoizer |
class | TextInput |
class | TextOutput |
class | TrackedObject |
class | Tracker |
struct | UncheckedWeakPointer |
A weak pointer to an IMP::Object or IMP::RefCountedObject. More... | |
class | UsageException |
An exception for an invalid usage of IMP . More... | |
class | Value |
class | ValueException |
An exception for an invalid value being passed to IMP . More... | |
class | Vector |
class | VersionInfo |
Version and module information for Objects. More... | |
struct | WarningContext |
struct | WeakPointer |
Typedefs | |
typedef IMP::base::Vector < IMP::base::Pointer< Object > > | Objects |
A list of objects. More... | |
typedef ::boost::rand48 | RandomNumberGenerator |
typedef IMP::base::Vector < SetCheckState > | SetCheckStates |
typedef IMP::base::Vector < SetLogState > | SetLogStates |
typedef IMP::base::Vector < TextInput > | TextInputs |
typedef IMP::base::Vector < TextOutput > | TextOutputs |
typedef IMP::base::Vector < VersionInfo > | VersionInfos |
Enumerations | |
enum | CheckLevel { DEFAULT_CHECK = -1, NONE = 0, USAGE = 1, USAGE_AND_INTERNAL = 2 } |
Specify the level of runtime checks performed. More... | |
enum | LogLevel { DEFAULT = -1, SILENT = 0, WARNING = 0 +1, PROGRESS = 2, TERSE = 3, VERBOSE = 4, MEMORY = 4 +1 } |
The log levels supported by IMP . More... | |
Functions | |
TextOutput | create_temporary_file (std::string prefix="imp_temp", std::string suffix="") |
std::string | create_temporary_file_name (std::string prefix="imp_temp", std::string suffix="") |
template<class Tag > | |
unsigned int | get_as_unsigned_int (Index< Tag > i) |
std::string | get_data_path (std::string file_name) |
Return the full path to installed data. More... | |
std::string | get_example_path (std::string file_name) |
Return the path to installed example data for this module. More... | |
template<class Tag > | |
Index< Tag > | get_invalid_index () |
Strings | get_live_object_names () |
Objects | get_live_objects () |
TextOutput | get_log_target () |
boost::uint64_t | get_random_seed () |
std::string | get_relative_path (std::string base, std::string relative) |
std::string | get_unique_name (std::string templ) |
template<class T > | |
std::size_t | hash_value (const T &t) |
std::size_t | hash_value (double d) |
std::size_t | hash_value (int d) |
std::size_t | hash_value (bool d) |
std::size_t | hash_value (const std::string &d) |
template<class T > | |
std::size_t | hash_value (const std::vector< T > &t) |
template<class T > | |
std::size_t | hash_value (const __gnu_debug::vector< T > &t) |
template<class T > | |
bool | isinf (const T &a) |
Return true if a number is infinite. | |
template<class T > | |
bool | isnan (const T &a) |
Return true if a number is NaN. More... | |
template<class O > | |
O * | object_cast (Object *o) |
std::ostream & | operator<< (std::ostream &out, const Showable &s) |
template<class Tag , class Container , class T > | |
void | resize_to_fit (Container &v, Index< Tag > i, const T &default_value=T()) |
void | set_log_target (TextOutput l) |
Set the target for the log. More... | |
void | set_print_deprecation_messages (bool tf) |
Toggle printing of warnings on using deprecated classes. More... | |
void | set_show_leaked_objects (bool tf) |
template<class A > | |
void | swap (ConstVector< A > &a, ConstVector< A > &b) |
void | write_help (std::ostream &out=std::cerr) |
Variables | |
RandomNumberGenerator | random_number_generator |
A shared random number generator. More... | |
bool | run_quick_test |
Error checking and reporting | |
By default Error handling is provided by IMP/exception.h, Use the | |
void | set_check_level (CheckLevel tf) |
Control runtime checks in the code. More... | |
CheckLevel | get_check_level () |
Get the current audit mode. | |
void | handle_error (const char *msg) |
Flags | |
These methods add support for shared command line flags to In C++, you can also use the AddFloatFlag, AddStringFlag, AddBoolFlag and AddIntFlag classes to add flags statically. | |
std::string | get_executable_name () |
void | setup_from_argv (int argc, char **argv, std::string description) |
Strings | setup_from_argv (int argc, char **argv, std::string description, std::string positional_description, int num_positional) |
void | setup_from_argv (const Strings &argv, std::string description) |
Strings | setup_from_argv (const Strings &argv, std::string description, std::string positional_description, int num_positional) |
void | add_string_flag (std::string name, std::string default_value, std::string description) |
std::string | get_string_flag (std::string name) |
void | add_int_flag (std::string name, size_t default_value, std::string description) |
size_t | get_int_flag (std::string name) |
void | add_bool_flag (std::string name, std::string description) |
bool | get_bool_flag (std::string name) |
void | add_float_flag (std::string name, double default_value, std::string description) |
double | get_float_flag (std::string name) |
Logging | |
Logging is provided by IMP/log.h. People implementing IMP::Object classes should also see IMP_OBJECT_LOG() and IMP::SetLogState. All logging is disabled when | |
void | add_to_log (LogLevel level, std::string to_write) |
Write a string to the log, for python. | |
void | set_log_level (LogLevel l) |
Set the current global log level. More... | |
void | set_log_timer (bool tb) |
Set whether log messages are tagged with the current log time. | |
void | reset_log_timer () |
Reset the log timer. | |
LogLevel | get_log_level () |
Get the currently active log level. More... | |
Create a progress bar in the terminal | |
void | set_progress_display (std::string description, unsigned int steps) |
void | add_to_progress_display (unsigned int step=1) |
Number of threads | |
unsigned int | get_number_of_threads () |
void | set_number_of_threads (unsigned int n) |
typedef IMP::base::Vector<IMP::base::Pointer< Object > > IMP::base::Objects |
Pass or store a set of SetCheckState .
Definition at line 58 of file SetCheckState.h.
typedef IMP::base::Vector< SetLogState > IMP::base::SetLogStates |
Pass or store a set of SetLogState .
Definition at line 54 of file SetLogState.h.
typedef IMP::base::Vector< TextInput > IMP::base::TextInputs |
Pass or store a set of TextInput .
Definition at line 158 of file base/file.h.
typedef IMP::base::Vector< TextOutput > IMP::base::TextOutputs |
Pass or store a set of TextOutput .
Definition at line 159 of file base/file.h.
typedef IMP::base::Vector< VersionInfo > IMP::base::VersionInfos |
Pass or store a set of VersionInfo .
Definition at line 49 of file base/VersionInfo.h.
Enumerator | |
---|---|
DEFAULT_CHECK |
Use the default check level (eg IMP::base::Object::set_check_level()). |
NONE |
Perform no runtime checks. |
USAGE |
Perform checks that |
USAGE_AND_INTERNAL |
Check internal |
enum IMP::base::LogLevel |
Enumerator | |
---|---|
DEFAULT |
Use to specify that the global log level should be used (eg in IMP::base::Object::set_log_level()) |
SILENT |
Do not output any text. |
WARNING |
Output only warnings. |
PROGRESS |
Output only progress meter style displays and occasional printouts when switching phases of work. |
TERSE |
Output a line or two per evaluation call. |
VERBOSE |
Produce copious output to allow someone to trace through the computation. |
MEMORY |
Log memory allocations and frees. |
void IMP::base::add_bool_flag | ( | std::string | name, |
std::string | description | ||
) |
For python use. Default is always false.
void IMP::base::add_float_flag | ( | std::string | name, |
double | default_value, | ||
std::string | description | ||
) |
For python use.
void IMP::base::add_int_flag | ( | std::string | name, |
size_t | default_value, | ||
std::string | description | ||
) |
For python use.
void IMP::base::add_string_flag | ( | std::string | name, |
std::string | default_value, | ||
std::string | description | ||
) |
For python use.
void IMP::base::add_to_progress_display | ( | unsigned int | step = 1 | ) |
Set the current progress. When it equals the number of steps, the bar is done.
TextOutput IMP::base::create_temporary_file | ( | std::string | prefix = "imp_temp" , |
std::string | suffix = "" |
||
) |
Create a temporary file. The path can be extracted from the TextOutput.
If suffix is non-empty, there is some small chance of a collision on non-BSD systems as a unique temporary file is first created, and then a file with that suffix appended is created.
std::string IMP::base::create_temporary_file_name | ( | std::string | prefix = "imp_temp" , |
std::string | suffix = "" |
||
) |
Create a temporary file.
If suffix is non-empty, there is some small chance of a collision on non-BSD systems as a unique temporary file is first created, and then a file with that suffix appended is created.
bool IMP::base::get_bool_flag | ( | std::string | name | ) |
For python use.
std::string IMP::base::get_data_path | ( | std::string | file_name | ) |
Each module has its own data directory, so be sure to use the version of this function in the correct module. To read the data file "data_library" that was placed in the data
directory of module "mymodule", do something like
This will ensure that the code works when IMP
is installed or used via the tools/imppy.sh
script.
std::string IMP::base::get_example_path | ( | std::string | file_name | ) |
Each module has its own example directory, so be sure to use the version of this function in the correct module. For example to read the file example_protein.pdb
located in the examples
directory of the IMP::atom module, do
This will ensure that the code works when IMP
is installed or used via the tools/imppy.sh
script.
std::string IMP::base::get_executable_name | ( | ) |
Return the name of the current executable.
double IMP::base::get_float_flag | ( | std::string | name | ) |
For python use.
size_t IMP::base::get_int_flag | ( | std::string | name | ) |
For python use.
Strings IMP::base::get_live_object_names | ( | ) |
Return the names of all live objects, use this to check for memory leaks.
Objects IMP::base::get_live_objects | ( | ) |
Return the points to all live objects, use this to check for memory leaks.
LogLevel IMP::base::get_log_level | ( | ) |
This may not always match the value passed to set_log_level() as objects can temporarily override the global level while they are evaluating.
Definition at line 81 of file base/log.h.
unsigned int IMP::base::get_number_of_threads | ( | ) |
Get the current number of threads requested.
boost::uint64_t IMP::base::get_random_seed | ( | ) |
Return the initial random seed.
std::string IMP::base::get_relative_path | ( | std::string | base, |
std::string | relative | ||
) |
Return a path to a file relative to another file. For example if base is path/to/config.file and relative is data/image0.jpg then the return value would be path/to/data/image0.jpg. This function should be used when processing configuration files so that the meaning of the configuration file does not change if current working directory changes.
std::string IMP::base::get_string_flag | ( | std::string | name | ) |
For python use.
std::string IMP::base::get_unique_name | ( | std::string | templ | ) |
Return a unique name produced from the string by replacing %1% with a sequential number.
void IMP::base::handle_error | ( | const char * | msg | ) |
This function is called whenever IMP detects an error. It can be useful to add a breakpoint in the function when using a debugger.
bool IMP::base::isnan | ( | const T & | a | ) |
O* IMP::base::object_cast | ( | Object * | o | ) |
Up (or down) cast an IMP
Object-derived class. If the cast does not succeed a ValueException will be thrown. Use a dynamic_cast
if you prefer to have a nullptr returned.
Definition at line 24 of file object_cast.h.
void IMP::base::set_check_level | ( | CheckLevel | tf | ) |
The default level of checks is USAGE for release builds and USAGE_AND_INTERNAL for debug builds.
Definition at line 80 of file base/exception.h.
void IMP::base::set_log_level | ( | LogLevel | l | ) |
Note that this should not, currently, be used directly during Model::evaluate() calls.
void IMP::base::set_log_target | ( | TextOutput | l | ) |
See TextOutput for options. Python users should use SetLogTarget instead.
void IMP::base::set_number_of_threads | ( | unsigned int | n | ) |
Set the current number of threads to a number greater or equal to 1. Setting it to 1 disables multithreaded evaluation.
void IMP::base::set_print_deprecation_messages | ( | bool | tf | ) |
If set to true (the default) a warning is printed every time a class marked as deprecated is used.
void IMP::base::set_progress_display | ( | std::string | description, |
unsigned int | steps | ||
) |
Set up the progress bar with the passed description.
void IMP::base::set_show_leaked_objects | ( | bool | tf | ) |
Set whether to complain about objects not being properly cleaned up.
void IMP::base::setup_from_argv | ( | int | argc, |
char ** | argv, | ||
std::string | description | ||
) |
Parse the command line flags and return the positional arguments.
[in] | argc | argc |
[in] | argv | argv |
[in] | description | A message describing what the program does. |
Strings IMP::base::setup_from_argv | ( | int | argc, |
char ** | argv, | ||
std::string | description, | ||
std::string | positional_description, | ||
int | num_positional | ||
) |
Parse the command line flags and return the positional arguments.
[in] | argc | argc |
[in] | argv | argv |
[in] | description | A message describing what the program does. |
[in] | positional_description | A message describing the the positional arguments |
[in] | num_positional | A positive integer to require that many positional arguments, or a negative integer to require at least that many. |
void IMP::base::setup_from_argv | ( | const Strings & | argv, |
std::string | description | ||
) |
Parse the command line flags and return the positional arguments. For python.
[in] | argv | sys.argv |
[in] | description | A message describing what the program does. |
Strings IMP::base::setup_from_argv | ( | const Strings & | argv, |
std::string | description, | ||
std::string | positional_description, | ||
int | num_positional | ||
) |
Parse the command line flags and return the positional arguments. For python.
[in] | argv | sys.argv |
[in] | description | A message describing what the program does. |
[in] | positional_description | A message describing the positional arguments, eg "input.pdb output.pdb" |
[in] | num_positional | A positive integer to require that many positional arguments, or a negative integer to require at least that many. |
void IMP::base::write_help | ( | std::ostream & | out = std::cerr | ) |
Prints out the help message, useful if you have extra error checking and the flags don't pass it.
RandomNumberGenerator IMP::base::random_number_generator |
The random number generator is seeded based of of the current time. To provide a better seed or use a constant seed call random_number_generator.seed(x) with a 32 bit int or a 64 bit unsigned int. This generator can be used by the
Boost.Random distributions.
bool IMP::base::run_quick_test |
Executables can inspect this flag and when it is true, run a shorter, simpler version of their code to just make sure things work.