AGX Dynamics  2.37.3.2
ActionImplementation.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
18 
19 
20 
21 #ifndef AGXCONTROL_ACTION_IMPLEMENTATION_H
22 #define AGXCONTROL_ACTION_IMPLEMENTATION_H
23 
24 #include <agx/config.h>
25 
26 
27 #include <agx/Referenced.h>
28 #include <agxStream/Serializable.h>
29 #include <agxStream/InputArchive.h>
31 
33 #include <functional>
34 
35 namespace agxControl
36 {
37 
38  class CallbackActionImplementation;
39  template<typename T> class Callback1ActionImplementation;
40  template<typename R, typename T> class CallbackR1ActionImplementation;
41  template<typename T1, typename T2> class Callback2ActionImplementation;
42 
43  AGX_DECLARE_POINTER_TYPES(ActionImplementation);
44 
45  /*
46  The ActionImplementation is the base class for work that an Action can perform.
47  It inherits from Serializable, but many of the subclasses cannot be serialized
48  completely due to the use of function pointers. They do however store as much
49  as they can.
50  */
51  class AGXPHYSICS_EXPORT ActionImplementation : public agx::Referenced, public agxStream::Serializable
52  {
53  public:
55  ActionImplementation(agx::Real time);
56 
63  virtual void trigger(agx::Real time);
64 
66  void trigger();
67 
69  agx::Real getTime() const;
70 
74  virtual void visit(agxControl::ActionImplementationVisitor* operation, agx::Real time);
75 
80  virtual void visit(agxControl::ActionImplementationVisitor* operation, ActionImplementation* end, agx::Real time);
81 
82  AGXSTREAM_DECLARE_SERIALIZABLE( agxControl::ActionImplementation );
83 
84  protected:
85  virtual ~ActionImplementation() {};
86 
88  ActionImplementation() {}
89 
90  public:
91 
104  virtual void dispatchVisit(agxControl::ActionImplementationVisitor* operation, agxControl::CallbackActionImplementation* begin, agx::Real time);
105  virtual void dispatchVisit(agxControl::ActionImplementationVisitor* operation, agxControl::Callback1ActionImplementation<agx::Real>* begin, agx::Real time);
106  virtual void dispatchVisit(agxControl::ActionImplementationVisitor* operation, agxControl::CallbackR1ActionImplementation<void, agx::Real>* begin, agx::Real time);
107  virtual void dispatchVisit(agxControl::ActionImplementationVisitor* operation, agxControl::Callback2ActionImplementation<agx::Real, agx::Int>* begin, agx::Real time);
108 
109  protected:
110  static std::string m_className;
111 
112  private:
113  agx::Real m_time;
114  };
115 
116 
118  class AGXPHYSICS_EXPORT VoidActionImplementation : public ActionImplementation
119  {
120  public:
121  VoidActionImplementation(agx::Real time);
122  protected:
123  virtual ~VoidActionImplementation() {}
124  };
125 
130  class AGXPHYSICS_EXPORT CallbackActionImplementation : public ActionImplementation
131  {
132  public:
133  typedef std::function<void (agx::Real)> Callback;
134 
135  template<typename ClassT>
136  CallbackActionImplementation(agx::Real time, void (ClassT::*function)(agx::Real), ClassT* object);
137 
138  virtual void trigger(agx::Real currentTime);
139  using ActionImplementation::trigger;
140 
141  virtual void visit(agxControl::ActionImplementationVisitor* operation, agx::Real time);
142  using ActionImplementation::visit;
143 
144  protected:
145  virtual ~CallbackActionImplementation() {}
146 
147  private:
148  Callback m_callback;
149  };
150 
151 
159  template<typename T>
160  class Callback1ActionImplementation : public ActionImplementation
161  {
162  public:
163  typedef std::function<void (T)> Callback;
164 
171  template<typename ClassT>
172  Callback1ActionImplementation(agx::Real time, void(ClassT::*function)(T), ClassT* object, const T& value );
173 
174  template<typename ClassT>
175  Callback1ActionImplementation(agx::Real time, void(ClassT::*function)(const T&), ClassT* object, const T& value );
176 
178  void setValue( const T& newValue);
179 
181  const T& getValue() const;
182 
183 
184  virtual void trigger(agx::Real currentTime);
185  using ActionImplementation::trigger;
186 
187  virtual void visit(agxControl::ActionImplementationVisitor* operation, agx::Real time);
188  virtual void visit(agxControl::ActionImplementationVisitor* operation, ActionImplementation* end, agx::Real time);
189  virtual void dispatchVisit(agxControl::ActionImplementationVisitor* operation, agxControl::Callback1ActionImplementation<agx::Real>* begin, agx::Real time);
190 
191  using ActionImplementation::visit;
192  using ActionImplementation::dispatchVisit;
193 
194  // Serialization code. Cannot use AGXSTREAM_DECLARE_SERIALIZABLE macro because
195  // of templating. For example, the getConstructClassId() and getClassName()
196  // methods have to translate the <T> part of the name into a substring containing
197  // the actual type of T.
198  agxStream::StorageAgent* getStorageAgent() const { return agxStream::StorageManager::instance()->find( getConstructClassId() ); }
199  static const char* getConstructClassId();
200  friend class agxStream::DefStorageAgent<Callback1ActionImplementation>;
201  const char* getClassName() const;
202  static agxStream::Serializable* create() { return new Callback1ActionImplementation(); }
203  static agxStream::Serializable* create(agxStream::InputArchive&) { return new Callback1ActionImplementation(); }
204  void store( agxStream::OutputArchive& out ) const;
205  void restore( agxStream::InputArchive& in );
206 
207  // Used only by store/restore.
208  Callback1ActionImplementation();
209 
210  protected:
211  virtual ~Callback1ActionImplementation() {}
212  private:
213  Callback m_callback;
214  T m_value;
215  };
216 
217 
218  /*
219  An ActionImplementation that works the same way as the Callback1ActionImplementation,
220  but supports member functions with a return value. The returned value is ignored.
221  */
222  template<typename R, typename T>
223  class CallbackR1ActionImplementation : public ActionImplementation
224  {
225  public:
226  typedef std::function<R (T)> Callback;
227 
228 
229  template<typename ClassT>
230  CallbackR1ActionImplementation(agx::Real time, R (ClassT::*function)(T), ClassT* object, const T& value );
231 
232  void setValue( const T& newValue);
233  const T& getValue() const;
234 
235  virtual void trigger(agx::Real currentTime);
236  using ActionImplementation::trigger;
237 
238  virtual void visit(agxControl::ActionImplementationVisitor* operation, agx::Real time);
239  virtual void visit(agxControl::ActionImplementationVisitor *operation, ActionImplementation* end, agx::Real time);
240  virtual void dispatchVisit(agxControl::ActionImplementationVisitor* operation, agxControl::CallbackR1ActionImplementation<void, agx::Real>* begin, agx::Real time);
241 
242  using ActionImplementation::visit;
243  using ActionImplementation::dispatchVisit;
244 
245  // Serialization code. Cannot use AGXSTREAM_DECLARE_SERIALIZABLE macro because
246  // of templating. For example, the getConstructClassId() and getClassName()
247  // methods have to translate the <R, T> part of the name into a substring
248  // containing the actual types for R and T.
249  agxStream::StorageAgent* getStorageAgent() const { return agxStream::StorageManager::instance()->find( getConstructClassId() ); }
250  static const char* getConstructClassId();
251  friend class agxStream::DefStorageAgent<CallbackR1ActionImplementation>;
252  const char* getClassName() const;
253  static agxStream::Serializable* create() { return new CallbackR1ActionImplementation(); }
254  static agxStream::Serializable* create(agxStream::InputArchive&) { return new CallbackR1ActionImplementation(); }
255  void store( agxStream::OutputArchive& out ) const;
256  void restore( agxStream::InputArchive& in );
257 
258  // Used only by store/restore.
259  CallbackR1ActionImplementation();
260 
261  protected:
262  virtual ~CallbackR1ActionImplementation() {}
263  private:
264  Callback m_callback;
265  T m_value;
266  };
267 
268 
269  /*
270  An ActionImplementation that works the same way as the Callback1ActionImplementation,
271  but supports member functions with two arguments.
272  */
273  template<typename T1, typename T2>
274  class Callback2ActionImplementation : public ActionImplementation
275  {
276  public:
277  typedef std::function<void (T1, T2)> Callback;
278 
279  template<typename ClassT>
280  Callback2ActionImplementation(agx::Real, void (ClassT::*function)(T1, T2), ClassT* object, const T1& value1, const T2& value2);
281 
282  void setValue1( const T1& newValue);
283  void setValue2( const T2& newValue);
284 
285  const T1& getValue1() const;
286  const T2& getValue2() const;
287 
288  virtual void trigger(agx::Real currentTime);
289  using ActionImplementation::trigger;
290 
291  virtual void visit(agxControl::ActionImplementationVisitor* operation, agx::Real time);
292  virtual void visit(agxControl::ActionImplementationVisitor *operation, ActionImplementation* end, agx::Real time);
293  virtual void dispatchVisit(agxControl::ActionImplementationVisitor* operation, agxControl::Callback2ActionImplementation<agx::Real, agx::Int>* begin, agx::Real time);
294 
295  using ActionImplementation::visit;
296  using ActionImplementation::dispatchVisit;
297 
298  // Serialization code. Cannot use AGXSTREAM_DECLARE_SERIALIZABLE macro because of templating.
299  agxStream::StorageAgent* getStorageAgent() const { return agxStream::StorageManager::instance()->find( getConstructClassId() ); }
300  static const char* getConstructClassId();
301  friend class agxStream::DefStorageAgent<Callback2ActionImplementation>;
302  const char* getClassName() const;
303  static agxStream::Serializable* create() { return new Callback2ActionImplementation(); }
304  static agxStream::Serializable* create(agxStream::InputArchive&) { return new Callback2ActionImplementation(); }
305  void store( agxStream::OutputArchive& out ) const;
306  void restore( agxStream::InputArchive& in );
307 
308  // Used only by store/restore.
309  Callback2ActionImplementation();
310 
311  protected:
312  virtual ~Callback2ActionImplementation() {}
313  private:
314  Callback m_callback;
315  T1 m_value1;
316  T2 m_value2;
317  };
318 
319 
320 
321 
322 
323  /* Implementation, CallbackActionImplementation */
324 
325  template<typename ClassT>
326  CallbackActionImplementation::CallbackActionImplementation(
327  agx::Real time, void (ClassT::*function)(agx::Real), ClassT* object
328  ):
329  ActionImplementation(time), m_callback(std::bind(function, object,std::placeholders:: _1))
330  {
331  }
332 
333 
334  /* Implementation, Callback1ActionImplementation */
335 
336  template<typename T>
337  Callback1ActionImplementation<T>::Callback1ActionImplementation():
338  ActionImplementation(agx::Real(-1.0)), m_value(T())
339  {
340  }
341 
342 
343  template<typename T> template<typename ClassT>
344  Callback1ActionImplementation<T>::Callback1ActionImplementation(
345  agx::Real time, void (ClassT::*function)(T), ClassT* object, const T& value
346  ):
347  ActionImplementation(time), m_callback(std::bind(function, object,std::placeholders:: _1)), m_value(value)
348  {
349  }
350 
351  template<typename T> template<typename ClassT>
352  Callback1ActionImplementation<T>::Callback1ActionImplementation(
353  agx::Real time, void (ClassT::*function)(const T&), ClassT* object, const T& value
354  ):
355  ActionImplementation(time), m_callback(std::bind(function, object,std::placeholders:: _1)), m_value(value)
356  {
357  }
358 
359  template<typename T>
360  inline void Callback1ActionImplementation<T>::setValue(const T& newValue)
361  {
362  m_value = newValue;
363  }
364 
365 
366  template<typename T>
367  inline const T& Callback1ActionImplementation<T>::getValue() const
368  {
369  return m_value;
370  }
371 
372 
373  template<typename T>
374  inline void Callback1ActionImplementation<T>::trigger(agx::Real /*currentTime*/)
375  {
376  m_callback(m_value);
377  }
378 
379 
380  template<typename T>
381  inline void Callback1ActionImplementation<T>::visit(agxControl::ActionImplementationVisitor* operation, agx::Real time)
382  {
383  operation->update(this, time);
384  }
385 
386  template<typename T>
387  inline void Callback1ActionImplementation<T>::visit(
388  agxControl::ActionImplementationVisitor* /*operation*/, ActionImplementation* /*end*/, agx::Real /*time*/)
389  {
390  agxAbort1("Action: Asked to visit Callback1Actions with unsupported template parameters.");
391  }
392 
393  template<>
394  inline void Callback1ActionImplementation<agx::Real>::visit(
395  agxControl::ActionImplementationVisitor* operation, ActionImplementation* end, agx::Real time)
396  {
397  end->dispatchVisit(operation, this, time);
398  }
399 
400  template<typename T>
401  inline void Callback1ActionImplementation<T>::dispatchVisit(agxControl::ActionImplementationVisitor* /*operation*/,
402  agxControl::Callback1ActionImplementation<agx::Real>* /*begin*/, agx::Real /*time*/)
403  {
404  agxAbort1("Action: Asked to dispatch visit Callback1Actions with unsupported template parameters.");
405  }
406 
407 
408  template<>
409  inline void Callback1ActionImplementation<agx::Real>::dispatchVisit(agxControl::ActionImplementationVisitor* operation,
410  agxControl::Callback1ActionImplementation<agx::Real> *begin, agx::Real time)
411  {
412  operation->update(begin, this, time);
413  }
414 
415  template<typename T>
416  inline void Callback1ActionImplementation<T>::store(agxStream::OutputArchive& out) const
417  {
418  this->ActionImplementation::store(out);
419  out << agxStream::out("value", m_value);
420  }
421 
422 
423  template<typename T>
424  inline void Callback1ActionImplementation<T>::restore(agxStream::InputArchive& in)
425  {
426  this->ActionImplementation::restore(in);
427  in >> agxStream::in("value", m_value);
428  }
429 
430 
431 
432 
433 
434  /* Implementation, CallbackR1ActionImplementation */
435 
436  template<typename R, typename T>
437  CallbackR1ActionImplementation<R,T>::CallbackR1ActionImplementation():
438  ActionImplementation(agx::Real(-1.0)), m_value(T(0))
439  {
440  }
441 
442 
443  template<typename R, typename T> template<typename ClassT>
444  CallbackR1ActionImplementation<R,T>::CallbackR1ActionImplementation(
445  agx::Real time, R (ClassT::*function)(T), ClassT* object, const T &value
446  ):
447  ActionImplementation(time), m_callback(std::bind(function, object,std::placeholders:: _1)), m_value(value)
448  {
449  }
450 
451 
452  template<typename R, typename T>
453  inline void CallbackR1ActionImplementation<R, T>::setValue(const T& newValue)
454  {
455  m_value = newValue;
456  }
457 
458 
459  template<typename R, typename T>
460  inline const T& CallbackR1ActionImplementation<R, T>::getValue() const
461  {
462  return m_value;
463  }
464 
465 
466  template<typename R, typename T>
467  inline void CallbackR1ActionImplementation<R, T>::trigger(agx::Real /*currentTime*/)
468  {
469  m_callback(m_value);
470  }
471 
472 
473  template<typename R, typename T>
474  inline void CallbackR1ActionImplementation<R,T>::visit(agxControl::ActionImplementationVisitor* operation, agx::Real time)
475  {
476  operation->update(this, time);
477  }
478 
479 
480  template<typename R, typename T>
481  inline void CallbackR1ActionImplementation<R, T>::visit(
482  agxControl::ActionImplementationVisitor* /*operation*/, ActionImplementation* /*end*/, agx::Real /*time*/)
483  {
484  agxAbort1("Action: Asked to visit CallbackR1Actions with unsupported template parameters.");
485  }
486 
487  template<>
488  inline void CallbackR1ActionImplementation<void, agx::Real>::visit(
489  agxControl::ActionImplementationVisitor* operation, ActionImplementation* end, agx::Real time)
490  {
491  end->dispatchVisit(operation, this, time);
492  }
493 
494  template<typename R, typename T>
495  inline void CallbackR1ActionImplementation<R, T>::dispatchVisit(agxControl::ActionImplementationVisitor* /*operation*/,
496  agxControl::CallbackR1ActionImplementation<void, agx::Real>* /*begin*/, agx::Real /*time*/)
497  {
498  agxAbort1("Action: Asked to mix CallbackR1Actions with unsupported template parameters.");
499  }
500 
501  template<>
502  inline void CallbackR1ActionImplementation<void, agx::Real>::dispatchVisit(
503  agxControl::ActionImplementationVisitor* operation,
504  agxControl::CallbackR1ActionImplementation<void, agx::Real> *begin, agx::Real time)
505  {
506  operation->update(begin, this, time);
507  }
508 
509  template<typename R, typename T>
510  inline void CallbackR1ActionImplementation<R, T>::store(agxStream::OutputArchive& out) const
511  {
512  this->ActionImplementation::store(out);
513  out << agxStream::out("value", m_value);
514  }
515 
516 
517  template<typename R, typename T>
518  inline void CallbackR1ActionImplementation<R, T>::restore(agxStream::InputArchive& in)
519  {
520  this->ActionImplementation::restore(in);
521  in >> agxStream::in("value", m_value);
522  }
523 
524 
525 
526  /* Implementation, Callback2ActionImplementation */
527 
528  template<typename T1, typename T2>
529  Callback2ActionImplementation<T1, T2>::Callback2ActionImplementation():
530  ActionImplementation(agx::Real(-1.0)), m_value1(T1(0)), m_value2(T2(0))
531  {
532  }
533 
534  template<typename T1, typename T2> template<typename ClassT>
535  Callback2ActionImplementation<T1, T2>::Callback2ActionImplementation(
536  agx::Real time, void (ClassT::*function)(T1, T2), ClassT *object, const T1 &value1, const T2 &value2
537  ):
538  ActionImplementation(time), m_callback(std::bind(function, object,std::placeholders:: _1,std::placeholders:: _2)),
539  m_value1(value1), m_value2(value2)
540  {
541  }
542 
543 
544  template<typename T1, typename T2>
545  inline void Callback2ActionImplementation<T1, T2>::setValue1(const T1& newValue)
546  {
547  m_value1 = newValue;
548  }
549 
550 
551  template<typename T1, typename T2>
552  inline void Callback2ActionImplementation<T1, T2>::setValue2(const T2& newValue)
553  {
554  m_value2 = newValue;
555  }
556 
557 
558  template<typename T1, typename T2>
559  inline const T1& Callback2ActionImplementation<T1, T2>::getValue1() const
560  {
561  return m_value1;
562  }
563 
564 
565  template<typename T1, typename T2>
566  inline const T2& Callback2ActionImplementation<T1, T2>::getValue2() const
567  {
568  return m_value2;
569  }
570 
571 
572  template<typename T1, typename T2>
573  inline void Callback2ActionImplementation<T1, T2>::trigger(agx::Real /*currentTime*/)
574  {
575  m_callback(m_value1, m_value2);
576  }
577 
578 
579  template<typename T1, typename T2>
580  inline void Callback2ActionImplementation<T1, T2>::visit(agxControl::ActionImplementationVisitor* operation, agx::Real time)
581  {
582  operation->update(this, time);
583  }
584 
585  template<typename T1, typename T2>
586  inline void Callback2ActionImplementation<T1, T2>::visit(
587  agxControl::ActionImplementationVisitor* /*operation*/, ActionImplementation* /*end*/, agx::Real /*time*/)
588  {
589  agxAbort1("Action: Asked to visit Callback2Actions with unsupported template parameters.");
590  }
591 
592  template<>
593  inline void Callback2ActionImplementation<agx::Real, agx::Int>::visit(
594  agxControl::ActionImplementationVisitor* operation, ActionImplementation* end, agx::Real time)
595  {
596  end->dispatchVisit(operation, this, time);
597  }
598 
599  template<typename T1, typename T2>
600  inline void Callback2ActionImplementation<T1, T2>::dispatchVisit(agxControl::ActionImplementationVisitor* /*operation*/,
601  agxControl::Callback2ActionImplementation<agx::Real, agx::Int>* /*begin*/, agx::Real /*time*/)
602  {
603  agxAbort1("Action: Asked to mix Callbac2Actions with unsupported template parameters.");
604  }
605 
606  template<>
607  inline void Callback2ActionImplementation<agx::Real, agx::Int>::dispatchVisit(
608  agxControl::ActionImplementationVisitor*operation,
609  agxControl::Callback2ActionImplementation<agx::Real, agx::Int> *begin,
610  agx::Real time)
611  {
612  operation->update(begin, this, time);
613  }
614 
615 
616  template<typename T1, typename T2>
617  inline void Callback2ActionImplementation<T1, T2>::store(agxStream::OutputArchive& out) const
618  {
619  this->ActionImplementation::store(out);
620  out << agxStream::out("Value1", m_value1);
621  out << agxStream::out("Value2", m_value2);
622  }
623 
624 
625  template<typename T1, typename T2>
626  inline void Callback2ActionImplementation<T1, T2>::restore(agxStream::InputArchive& in)
627  {
628  this->ActionImplementation::restore(in);
629  in >> agxStream::in("Value1", m_value1);
630  in >> agxStream::in("Value2", m_value2);
631  }
632 
633 
634 
635  /* Serialization helper code and type-to-string translations. */
636 
637  template<typename T> inline std::string templateToFormatName() { return std::string("UnknownFormat: \'") + typeid(T).name() + "\'"; }
638  template<> std::string inline templateToFormatName<bool>() { return std::string("Bool:8bit"); }
639  template<> std::string inline templateToFormatName<agx::Int32>() { return std::string("Int:32bit"); }
640  template<> std::string inline templateToFormatName<agx::Int64>() { return std::string("Int:64bit"); }
641  template<> std::string inline templateToFormatName<agx::Vec3f>() { return std::string("Vec3:32bit"); }
642  template<> std::string inline templateToFormatName<agx::Vec3d>() { return std::string("Vec3:64bit"); }
643 
644  template<typename T>
645  inline const char* Callback1ActionImplementation<T>::getConstructClassId()
646  {
647  // Cannot use stripClassName because it doesn't handle the '::' in the template
648  // parameters properly. For example when T=agx::Vec3T<double>.
649  m_className = "agxControl::Callback1ActionImplementation";
650  m_className = m_className + std::string("<") + templateToFormatName<T>() + ">";
651  return m_className.c_str();
652  }
653 
654  template<>
655  inline const char* Callback1ActionImplementation<agx::Real>::getConstructClassId()
656  {
657  return "agxControl::Callback1ActionImplementation<Real>";
658  }
659 
660  template<typename T>
661  inline const char* Callback1ActionImplementation<T>::getClassName() const
662  {
663  // Cannot use stripClassName because it doesn't handle the '::' in the template
664  // parameters properly. For example when T=agx::Vec3T<double>.
665  m_className = "agxControl::Callback1ActionImplementation";
666  m_className = m_className + std::string("<") + templateToFormatName<T>() + ">";
667  return m_className.c_str();
668  }
669 
670  template<>
671  inline const char* Callback1ActionImplementation<agx::Real>::getClassName() const
672  {
673  return "agxControl::Callback1ActionImplementation<Real>";
674  }
675 
676 
677  template<typename R, typename T>
678  inline const char* CallbackR1ActionImplementation<R, T>::getConstructClassId()
679  {
680  // Cannot use stripClassName because it doesn't handle the space in "<R, T>" properly,
681  //std::string className = agxStream::StorageAgent::stripClassName( "getConstructClassId", AGX_FUNCTION );
682  m_className = "agxControl::CallbackR1ActionImplementation<R, T>";
683  m_className = m_className.substr(0, m_className.length() - 6); // Strip away "<R, T>".
684  m_className += std::string("<") + templateToFormatName<R>() + ", " + templateToFormatName<T>() + ">";
685  return m_className.c_str();
686  }
687 
688  template<>
689  inline const char* CallbackR1ActionImplementation<agx::Real, agx::Real>::getConstructClassId()
690  {
691  return "agxControl::CallbackR1ActionImplementation<Real, Real>";
692  }
693 
694  template<typename R, typename T>
695  inline const char* CallbackR1ActionImplementation<R, T>::getClassName() const
696  {
697  // Cannot use stripClassName because it doesn't handle the space in "<R, T>" properly,
698  m_className = "agxControl::CallbackR1ActionImplementation<R, T>";
699  m_className = m_className.substr(0, m_className.length() - 6); // Strip away "<R, T>".
700  m_className += std::string("<") + templateToFormatName<R>() + ", " + templateToFormatName<T>() + ">";
701  return m_className.c_str();
702  }
703 
704  template<>
705  inline const char* CallbackR1ActionImplementation<agx::Real, agx::Real>::getClassName() const
706  {
707  return "agxControl::CallbackR1ActionImplementation<Real, Real>";
708  }
709 
710 
711  template<typename T1, typename T2>
712  inline const char* Callback2ActionImplementation<T1, T2>::getConstructClassId()
713  {
714  // Cannot use stripClassName because it doesn't handle the space in "<T1, T2>" properly,
715  m_className = "agxControl::Callback2ActionImplementation<T1, T2>";
716  m_className = m_className.substr(0, m_className.length() - 8); // Strip away "<T1, T2>"
717  m_className += std::string("<") + templateToFormatName<T1>() + ", " + templateToFormatName<T2>() + ">";
718  return m_className.c_str();
719  }
720 
721  template<>
722  inline const char* Callback2ActionImplementation<agx::Real, agx::Real>::getConstructClassId()
723  {
724  return "agxControl::Callback2ActionImplementation<Real, Real>";
725  }
726 
727  template<>
728  inline const char* Callback2ActionImplementation<agx::Real, agx::Int32>::getConstructClassId()
729  {
730  return "agxControl::Callback2ActionImplementation<Real, Int32>";
731  }
732 
733  template<>
734  inline const char* Callback2ActionImplementation<agx::Real, agx::Int64>::getConstructClassId()
735  {
736  return "agxControl::Callback2ActionImplementation<Real, Int64>";
737  }
738 
739  template<typename T1, typename T2>
740  inline const char* Callback2ActionImplementation<T1, T2>::getClassName() const
741  {
742  // Cannot use stripClassName because it doesn't handle the space in "<T1, T2>" properly,
743  m_className = "agxControl::Callback2ActionImplementation<T1, T2>";
744  m_className = m_className.substr(0, m_className.length() - 8); // Strip away "<T1, T2>"
745  m_className += std::string("<") + templateToFormatName<T1>() + ", " + templateToFormatName<T2>() + ">";
746  return m_className.c_str();
747  }
748 
749  template<>
750  inline const char* Callback2ActionImplementation<agx::Real, agx::Real>::getClassName() const
751  {
752  return "agxControl::Callback2ActionImplementation<Real, Real>";
753  }
754 
755  template<>
756  inline const char* Callback2ActionImplementation<agx::Real, agx::Int32>::getClassName() const
757  {
758  return "agxControl::Callback2ActionImplementation<Real, Int32>";
759  }
760 
761  template<>
762  inline const char* Callback2ActionImplementation<agx::Real, agx::Int64>::getClassName() const
763  {
764  return "agxControl::Callback2ActionImplementation<Real, Int64>";
765  }
766 }
767 
768 // Include guard
769 #endif
770 
InputRef< T > in(const char *name, T &obj)
Create an object with a name and a reference to the object that should be restored (usually a pointer...
Definition: InputArchive.h:400
OutputRef< Serializable > out(const char *name, const Serializable *obj)
Return an object that contain the name and the object that should be serialized to an archive...
STL namespace.
#define AGXPHYSICS_EXPORT
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
Base class providing referencing counted objects.
Definition: Referenced.h:119
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
LinearProbingHashSetImplementation< KeyT, HashT >::iterator begin(LinearProbingHashSetImplementation< KeyT, HashT > &set)
This namespace contains general operation and action classes which can be used to control a agxSDK::S...
AGXTERRAIN_EXPORT agx::Real & currentTime()
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:51
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Definition: Serializable.h:207
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:44
Class for writing serialized data in binary format to a stream.
Definition: OutputArchive.h:56
LinearProbingHashSetImplementation< KeyT, HashT >::iterator end(LinearProbingHashSetImplementation< KeyT, HashT > &set)
double Real
Definition: Real.h:42
#define agxAbort1(msg)
Definition: debug.h:165