IMP  2.0.0
The Integrative Modeling Platform
IMP::base::Object Class Referenceabstract

Common base class for heavy weight IMP objects. More...

#include "IMP/base/Object.h"

Inherits IMP::base::RefCounted.

Inherited by IMP::algebra::DynamicNearestNeighbor3D, IMP::algebra::NearestNeighborD< D >, IMP::algebra::VectorKDMetric, IMP::atom::CHARMMResidueTopologyBase, IMP::atom::CHARMMSegmentTopology, IMP::atom::CHARMMTopology, IMP::atom::ForceFieldParameters, IMP::atom::Mol2Selector, IMP::atom::PDBSelector, IMP::atom::SmoothingFunction, IMP::base::TrackedObject< Type, Tracker >, IMP::core::ClosePairsFinder, IMP::core::DataObject< Data >, IMP::display::Geometry, IMP::display::Writer, IMP::domino::AssignmentContainer, IMP::domino::AssignmentsTable, IMP::domino::ParticleStates, IMP::domino::ParticleStatesTable, IMP::domino::RestraintCache, IMP::domino::SubsetFilter, IMP::domino::SubsetFilterTable, IMP::em2d::CollisionCrossSection, IMP::em2d::Image, IMP::em2d::ImageReaderWriter, IMP::em2d::ProjectionFinder, IMP::em2d::ScoreFunction, IMP::em::CoarseCC, IMP::em::DensityMap, IMP::em::EnvelopeScore, IMP::em::MapReaderWriter, IMP::em::PCAAligner, IMP::isd::BivariateFunction, IMP::isd::FNormal, IMP::isd::GaussianProcessInterpolation, IMP::isd::MultivariateFNormalSufficient, IMP::isd::UnivariateFunction, IMP::isd::vonMises, IMP::isd::vonMisesSufficient, IMP::kernel::Configuration, IMP::kernel::ConfigurationSet, IMP::kernel::Model, IMP::kernel::ModelObject, IMP::kernel::Optimizer, IMP::kernel::OptimizerState, IMP::kernel::PairModifier, IMP::kernel::PairPredicate, IMP::kernel::PairScore, IMP::kernel::QuadModifier, IMP::kernel::QuadPredicate, IMP::kernel::QuadScore, IMP::kernel::Refiner, IMP::kernel::Sampler, IMP::kernel::SingletonModifier, IMP::kernel::SingletonPredicate, IMP::kernel::SingletonScore, IMP::kernel::TripletModifier, IMP::kernel::TripletPredicate, IMP::kernel::TripletScore, IMP::kernel::UnaryFunction, IMP::kernel::Undecorator, IMP::kmeans::KMeans, IMP::multifit::AssemblyHeader, IMP::multifit::ComponentHeader, IMP::multifit::Ensemble, IMP::multifit::FFTFitting, IMP::multifit::FFTFittingOutput, IMP::multifit::ProbabilisticAnchorGraph, IMP::multifit::ProteomicsData, IMP::multifit::ProteomicsEMAlignmentAtomic, IMP::multifit::SettingsData, IMP::multifit::TransformationClustering, IMP::rmf::LoadLink, IMP::rmf::SaveLink, IMP::rotamer::RotamerCalculator, IMP::rotamer::RotamerLibrary, IMP::statistics::Embedding, IMP::statistics::Metric, IMP::statistics::PartitionalClustering, and log.DummyObject.

Public Member Functions

virtual void clear_caches ()
 
virtual IMP::base::VersionInfo get_version_info () const =0
 Get information about the module and version of the object.
 
void set_check_level (CheckLevel l)
 
void set_log_level (LogLevel l)
 Set the logging level used in this object. More...
 
void set_was_used (bool tf) const
 
void show (std::ostream &out=std::cout) const
 

Protected Member Functions

 Object (std::string name)
 Construct an object with the given name. More...
 

Related Functions

(Note that these are not member functions.)

typedef IMP::base::Vector
< IMP::base::WeakPointer
< Object > > 
ObjectsTemp
 

Names

All objects have names to aid in debugging and inspection of the state of the system. These names are not necessarily unique and should not be used to store data or as keys into a table. Use the address of the object instead since objects cannot be copied.

const std::string & get_name () const
 
void set_name (std::string name)
 

Detailed Description

The base class for non value-type objects in IMP. Anything inheriting from IMP::Object has the following properties:

  • has a method Object::show() which writes one or more lines of text to a stream
  • has embedded information about the module and version which can be accessed using Object::get_version_info(). This information can be used to log what version of software is used to compute a result.
  • it has a local logging level which can override the global one allowing fine grained logging control.
  • in python, there is a method Class::get_from(Object *o) that attempts to case o to an object of type Class and throws and exception if it fails.
  • the object keeps track of whether it has been been used. See the IMP::Object::set_was_used() method for an explanation.

Objects can be outputted to standard streams using operator<<() which will call the Object::show() method.

Advanced:
Types inheriting from Object should always be created using new in C++ and passed using pointers and stored using IMP::Pointer objects. Note that you have to be careful of cycles and so must use IMP::WeakPointer objects to break cycles. See IMP::RefCounted for more information on reference counting. IMP_NEW() can help shorten creating a ref counted pointer. See IMP::Pointer for more information.

Definition at line 69 of file declare_Object.h.

Constructor & Destructor Documentation

IMP::base::Object::Object ( std::string  name)
protected

An instance of "%1%" in the string will be replaced by a unique index.

Member Function Documentation

virtual void IMP::base::Object::clear_caches ( )
virtual

Objects can have internal caches. This method resets them returning the object to its just-initialized state.

Reimplemented in IMP::kernel::ScoringFunction, IMP::core::ExcludedVolumeRestraint, and IMP::core::MinimumRestraint.

Definition at line 183 of file declare_Object.h.

void IMP::base::Object::set_check_level ( CheckLevel  l)

Each object can be assigned a different check level too.

Definition at line 103 of file declare_Object.h.

void IMP::base::Object::set_log_level ( LogLevel  l)

Each object can be assigned a different log level in order to, for example, suppress messages for verbose and uninteresting objects. If set to DEFAULT, the global level as returned by IMP::get_log_level() is used, otherwise the local one is used. Methods in classes inheriting from Object should start with IMP_OBJECT_LOG to change the log level to the local one for this object and increase the current indent.

void IMP::base::Object::set_was_used ( bool  tf) const

IMP provides warnings when objects are never used before they are destroyed. Examples of use include adding an IMP::Restraint to an IMP::Model. If an object is not properly marked as used, or your code is the one using it, call set_was_used(true) on the object.

Definition at line 167 of file declare_Object.h.

Friends And Related Function Documentation

Pass a set of objects.

Definition at line 63 of file types.h.


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