Seg3D  2.4
Seg3D is a free volume segmentation and processing tool developed by the NIH Center for Integrative Biomedical Computing at the University of Utah Scientific Computing and Imaging (SCI) Institute.
Public Member Functions | Protected Member Functions | Friends | List of all members
Core::StateHandler Class Reference
Inheritance diagram for Core::StateHandler:
Core::ConnectionHandler Core::AbstractViewer Core::TransferFunction Core::TransferFunctionFeature Seg3D::DataManager Seg3D::InterfaceManager Seg3D::Layer Seg3D::LayerGroup Seg3D::LayerManager Seg3D::LayerResampler Seg3D::PreferencesManager Seg3D::Project Seg3D::ProjectManager Seg3D::SliceRange Seg3D::StatusBar Seg3D::Tool Seg3D::ToolFactory Seg3D::ToolManager Seg3D::ViewerManager

Public Member Functions

 StateHandler (const std::string &type_str, bool auto_id)
 
template<class HANDLE , class T >
bool add_state (const std::string &key, HANDLE &state, const T &default_value)
 Add a local state variable with default value.
 
template<class HANDLE , class T >
bool add_state (const std::string &key, HANDLE &state, const T &default_value, const T &min_value, const T &max_value, const T &step)
 Add a local state variable with default value and min and max.
 
template<class HANDLE >
bool add_state (const std::string &key, HANDLE &state)
 Add a local state variable without default value.
 
template<class HANDLE >
bool add_state (const std::string &key, HANDLE &state, const std::string &default_option, const std::string &option_list)
 Add a local state variable with option list.
 
template<class HANDLE >
bool add_state (const std::string &key, HANDLE &state, const std::string &default_option, const std::vector< std::string > option_list)
 Add a local state variable with option list.
 
template<class HANDLE >
bool add_state (const std::string &key, HANDLE &state, const std::string &default_option, const std::vector< OptionLabelPair > option_list)
 Add a local state variable with option list.
 
template<class HANDLE >
bool add_state (const std::string &key, HANDLE &state, const std::vector< std::string > &default_options, const std::vector< OptionLabelPair > option_list)
 Add a local state variable with option list.
 
template<class HANDLE >
bool add_state (const std::string &key, HANDLE &state, const std::vector< std::string > &default_options, const std::string &option_list)
 Add a local state variable with option list.
 
template<class HANDLE , class T >
bool add_state (const std::string &key, HANDLE &state, const std::vector< T > &default_value)
 Add a local state variable without default value.
 
void invalidate ()
 this function is called when you need to delete something from the state engine, but may have More...
 
bool is_valid ()
 returns true if the function hasn't been invalidated
 
void mark_as_project_data ()
 Mask the states that are added to this state handler as project data.
 
void do_not_save_id_number ()
 The id number of the statehandler will not be saved.
 
void set_initializing (bool initializing)
 
bool load_states (const StateIO &state_io)
 Load the states into the StateIO variable.
 
bool save_states (StateIO &state_io)
 Save the states into the StateIO variable.
 
const std::string & get_statehandler_id () const
 The id of the handler that will be the prefix of the state variables.
 
const std::string & get_statehandler_id_base () const
 The id of the handler that will be the prefix of the state variables.
 
size_t get_statehandler_id_number () const
 The id number of the handler that will be at the end of the prefix.
 

Protected Member Functions

virtual void clean_up ()
 This function is called by invalidate to clean up stuff in the statehandler subclasses.
 
void enable_signals (bool enabled)
 This function enables/disables signals in the state variables.
 
virtual bool pre_load_states (const StateIO &state_io)
 
virtual bool post_load_states (const StateIO &state_io)
 
virtual bool pre_save_states (StateIO &state_io)
 
virtual bool post_save_states (StateIO &state_io)
 
virtual void state_changed ()
 
virtual int get_session_priority ()
 
virtual int get_version ()
 Get the version number of this class, this one is used for versioning of session files.
 
int get_loaded_version ()
 Get the version number of the data that was loaded.
 
void set_loaded_version (int loaded_version)
 Set the version number of the data that was loaded.
 
- Protected Member Functions inherited from Core::ConnectionHandler
void add_connection (const boost::signals2::connection &connection)
 
void add_connection (const ConnectionHandlerConnectionHandle &connection)
 
void disconnect_all ()
 

Friends

class StateEngine
 

Member Function Documentation

int Core::StateHandler::get_session_priority ( )
protectedvirtual

Returns the session priority of the state handler. State handlers with higher priorities gets loaded earlier than those with lower priorities. By default this functions returns -1, which means that the state handler won't be saved/loaded by the state engine.

Reimplemented in Seg3D::ViewerManager, Seg3D::ToolManager, Seg3D::LayerManager, and Seg3D::InterfaceManager.

void Core::StateHandler::invalidate ( )

this function is called when you need to delete something from the state engine, but may have

NOTE: This is needed to ensure that all states are removed from the state engine while the UI can still have lingering handles to the object. This situation occurs because of the Qt and Application thread to be separate and the messaging is synchronous without any

bool Core::StateHandler::post_load_states ( const StateIO state_io)
protectedvirtual

This virtual function can be implemented in the StateHandlers and will be called after its states are loaded. If it doesn't succeed it needs to return false.

Reimplemented in Seg3D::LayerManager, Seg3D::Project, Seg3D::Viewer, Seg3D::ViewerManager, Seg3D::LayerGroup, Seg3D::MaskLayer, Seg3D::ToolManager, Seg3D::DataLayer, Seg3D::LargeVolumeLayer, Seg3D::SpeedlineTool, and Core::TransferFunction.

bool Core::StateHandler::post_save_states ( StateIO state_io)
protectedvirtual

This virtual function can be implemented in the StateHandlers and will be called after its states are saved. If it doesn't succeed it needs to return false.

Reimplemented in Seg3D::LayerManager, Seg3D::Layer, Seg3D::ViewerManager, Seg3D::LayerGroup, Seg3D::ToolManager, and Core::TransferFunction.

bool Core::StateHandler::pre_load_states ( const StateIO state_io)
protectedvirtual

This virtual function can be implemented in the StateHandlers and will be called before its states are loaded. If it doesn't succeed it needs to return false.

Reimplemented in Seg3D::LayerManager, Seg3D::Viewer, Seg3D::ViewerManager, and Seg3D::ToolManager.

bool Core::StateHandler::pre_save_states ( StateIO state_io)
protectedvirtual

This virtual function can be implemented in the StateHandlers and will be called before its states are saved. If it doesn't succeed it needs to return false.

Reimplemented in Seg3D::LayerManager, Seg3D::Project, Seg3D::MaskLayer, Seg3D::ToolManager, Seg3D::DataLayer, and Seg3D::LargeVolumeLayer.

void Core::StateHandler::set_initializing ( bool  initializing)

This function denotes whether a state handler is initializing or not. During the initializing phase signals and thread checking are turned off

void Core::StateHandler::state_changed ( )
protectedvirtual

This function is called when any of the state variables are changed and can be overloaded to implement a general function that needs to be called each time the state is updated.


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