iMSTK
Interactive Medical Simulation Toolkit
imstkComponent.cpp
1 /*
2 ** This file is part of the Interactive Medical Simulation Toolkit (iMSTK)
3 ** iMSTK is distributed under the Apache License, Version 2.0.
4 ** See accompanying NOTICE for details.
5 */
6 
7 #include "imstkComponent.h"
8 #include "imstkLogger.h"
9 
10 namespace imstk
11 {
12 void
14 {
15  // Generally the callee should only initialize entities
16  CHECK(m_entity.lock() != nullptr) << "Tried to initialize a component that doesn't exist"
17  " on any entity.";
18 
19  // Initialize
20  init();
21 }
22 
23 void
24 LambdaBehaviour::update(const double& dt)
25 {
26  if (m_updateFunc != nullptr)
27  {
28  m_updateFunc(dt);
29  }
30 }
31 
32 void
33 LambdaBehaviour::visualUpdate(const double& dt)
34 {
35  if (m_visualUpdateFunc != nullptr)
36  {
37  m_visualUpdateFunc(dt);
38  }
39 }
40 } // namespace imstk
std::weak_ptr< Entity > m_entity
Parent entity this component exists on.
void initialize()
Initialize the component, called at a later time after all component construction is complete...
Compound Geometry.
virtual void init()
Initialize the component, called at a later time after all component construction is complete...