|
@@ -55,6 +55,7 @@
|
|
#include <vector>
|
|
#include <vector>
|
|
|
|
|
|
#include "log.hpp"
|
|
#include "log.hpp"
|
|
|
|
+#include "config.hpp"
|
|
|
|
|
|
/**
|
|
/**
|
|
* The namespace containing all filval classes and functions.
|
|
* The namespace containing all filval classes and functions.
|
|
@@ -334,7 +335,7 @@ class GenValue{
|
|
/**
|
|
/**
|
|
* If logging is enabled for this value, this function should be
|
|
* If logging is enabled for this value, this function should be
|
|
* implemented to format the value to a string and place it as an INFO
|
|
* implemented to format the value to a string and place it as an INFO
|
|
- * entry in the log file. Useful for debugging, but may produce alot of
|
|
|
|
|
|
+ * entry in the log file. Useful for debugging, but may produce a lot of
|
|
* output.
|
|
* output.
|
|
*/
|
|
*/
|
|
virtual void log() = 0;
|
|
virtual void log() = 0;
|
|
@@ -423,6 +424,7 @@ class Value : public GenValue{
|
|
Value(const std::string& name, const std::string& alias="")
|
|
Value(const std::string& name, const std::string& alias="")
|
|
:value_to_string([](T){return "";}),
|
|
:value_to_string([](T){return "";}),
|
|
GenValue(typeid(T), name, alias){ }
|
|
GenValue(typeid(T), name, alias){ }
|
|
|
|
+
|
|
/** Calculate, if necessary, and return the value held by this object.
|
|
/** Calculate, if necessary, and return the value held by this object.
|
|
*/
|
|
*/
|
|
virtual T& get_value() = 0;
|
|
virtual T& get_value() = 0;
|
|
@@ -458,6 +460,9 @@ class ObservedValue : public Value<T>{
|
|
val_ref(val_ref){ }
|
|
val_ref(val_ref){ }
|
|
|
|
|
|
void log(){
|
|
void log(){
|
|
|
|
+ if (util::debug_on) {
|
|
|
|
+ std::cout << "Calculating Value: " << this->get_name() << std::endl;
|
|
|
|
+ }
|
|
if(this->logging_enabled){
|
|
if(this->logging_enabled){
|
|
INFO(this->get_name() << ": " << this->value_to_string(*val_ref));
|
|
INFO(this->get_name() << ": " << this->value_to_string(*val_ref));
|
|
}
|
|
}
|
|
@@ -511,6 +516,9 @@ class DerivedValue : public Value<T>{
|
|
:Value<T>(name, alias){ }
|
|
:Value<T>(name, alias){ }
|
|
|
|
|
|
void log(){
|
|
void log(){
|
|
|
|
+ if (util::debug_on) {
|
|
|
|
+ std::cout << "Calculating Value: " << this->get_name() << std::endl;
|
|
|
|
+ }
|
|
if(this->logging_enabled){
|
|
if(this->logging_enabled){
|
|
INFO(this->get_name() << ": " << this->value_to_string(value));
|
|
INFO(this->get_name() << ": " << this->value_to_string(value));
|
|
}
|
|
}
|