00001
00002
00003 #include "VisFramework/VisFrameworkBase/interface/VisContent.h"
00004 #include "VisFramework/VisFrameworkBase/interface/VisQueueProcessor.h"
00005 #include "VisFramework/VisFrameworkBase/interface/VisQueue.h"
00006 #include <iostream>
00007 #include <classlib/utils/Callback.h>
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 VisContent::VisContent (IgState *state, IgStateKey key,
00020 Type which, lat::Callback action)
00021 : m_state (state),
00022 m_key (key)
00023 {
00024 ASSERT (m_state);
00025 m_state->put (m_key, this);
00026
00027 if (which == MAIN_THREAD && action)
00028 action ();
00029 else if (which == EVENT_THREAD && action)
00030
00031 if (VisQueueProcessor::get (m_state))
00032 VisQueue::get (m_state)->push (action);
00033 else
00034 action ();
00035 }
00036
00037 VisContent::VisContent (IgState *state, IgStateKey key,
00038 lat::Callback mainAction, lat::Callback eventAction)
00039 : m_state (state),
00040 m_key (key)
00041 {
00042 ASSERT (m_state);
00043 m_state->put (m_key, this);
00044
00045 if (mainAction)
00046 mainAction ();
00047 if (eventAction)
00048
00049 if (VisQueueProcessor::get (m_state))
00050 VisQueue::get (m_state)->push (eventAction);
00051 else
00052 eventAction ();
00053 }
00054
00057 VisContent::~VisContent (void)
00058 { ASSERT (m_state); m_state->detach (m_key); }