IMP logo
IMP Reference Guide  2.10.0
The Integrative Modeling Platform
Parameter.h
Go to the documentation of this file.
1 /**
2  * \file npctransport/Parameter.h
3  * \brief description
4  *
5  * Copyright 2007-2018 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPNPCTRANSPORT_PARAMETER_H
9 #define IMPNPCTRANSPORT_PARAMETER_H
10 
11 #include "npctransport_config.h"
12 #include <IMP/check_macros.h>
13 
14 IMPNPCTRANSPORT_BEGIN_NAMESPACE
15 
16 template <class T>
17 class Parameter {
18  private:
19  T t_;
20  bool init_;
21 
22  public:
23  Parameter() : init_(false) {}
24 
25  Parameter(T t) : t_(t), init_(true) {}
26 
27  T get_value() const {
28  IMP_USAGE_CHECK(init_, "npctransort::Parameter Not initialized");
29  return t_;
30  }
31 
32 #ifndef SWIG
33  operator T() const {
34  return get_value();
35 }
36 
37  void operator=(T t) {
38  t_ = t;
39  init_ = true;
40 }
41 #endif
42 
43  bool is_init() { return init_; }
44 };
45 
46 
47 IMPNPCTRANSPORT_END_NAMESPACE
48 
49 #endif /* IMPNPCTRANSPORT_PARAMETER_H */
Exception definitions and assertions.
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Definition: check_macros.h:168