5 #include "tbb/tbb_allocator.h"
14 auto& indexToUse =
result.first->second;
19 if(0 == indexToUse.value_) {
21 unsigned int previous = 0;
22 indexToUse.value_.compare_exchange_strong(previous,newIndex);
24 id_ = indexToUse.value_.load();
27 auto& allNames =
names();
28 allNames.grow_to_at_least(
id_+1);
29 auto& storedName = allNames[
id_];
30 if(not storedName.string_) {
31 std::unique_ptr<std::string> newName(
new std::string{name});
33 if( storedName.string_.compare_exchange_strong(previous,newName.get())) {
59 std::vector<std::string> svec;
60 std::vector<double> dvec;
62 for(; it != v.end(); ++it )
64 vecPair_->second.first.push_back( it->first );
65 vecPair_->second.second.push_back( it->second );
75 std::vector<std::string> svec( 1,
"" );
76 std::vector<double> dvec( 1, val );
87 std::vector<std::string> svec( 1, sval );
88 std::vector<double> dvec( 1, dval );
98 std::vector<std::string> svec( 1, sval );
99 std::vector<double> dvec( 1, 0 );
138 const std::vector<double> &
147 std::string message =
"DDValue " +
name() +
" is not numerically evaluated! Use DDValue::std::strings()!";
155 o << v.
name() <<
" = ";
159 for(; i < v.
size(); ++
i )
161 o <<
'(' << v[
i].first <<
',' << v[
i].second <<
") ";
166 const std::vector<std::string> &
s = v.
strings();
167 for(; i < v.
size(); ++
i )
178 return o << v.second;
190 std::string message =
"DDValue " +
name() +
" is not numerically evaluated! Use DDValue::std::strings()!";
const std::string & name(void) const
the name of the DDValue
DDValue(void)
create a unnamed emtpy value. One can assing a named DDValue to it.
const std::vector< double > & doubles() const
a reference to the double-valued values stored in the given instance of DDValue
tbb::concurrent_vector< StringHolder, tbb::zero_allocator< StringHolder >> Names
void setEvalState(bool newState)
set to true, if the double-values (method DDValue::doubles()) make sense
std::ostream & operator<<(std::ostream &out, const ALILine &li)
unsigned int id(void) const
returns the ID of the DDValue
bool isEvaluated(void) const
true, if values are numerical evaluated; else false.
static Names initializeNames()
static NamesToIndicies & indexer()
void init(const std::string &)
bool operator==(const DDValue &v) const
Two DDValues are equal only if their id() is equal AND their values are equal.
tbb::concurrent_unordered_map< std::string, AtomicUInt > NamesToIndicies
static std::atomic< unsigned int > lastIndex
const std::vector< std::string > & strings() const
a reference to the std::string-valued values stored in the given instance of DDValue ...
std::shared_ptr< vecpair_type > vecPair_
DDValuePair operator[](unsigned int i) const
bool operator<(const DDValue &) const
A DDValue a is smaller than a DDValue b if (a.id()<b.id()) OR (a.id()==b.id() and value(a)<value(b)) ...
unsigned int size() const
the size of the stored value-pairs (std::string,double)
std::pair< bool, std::pair< std::vector< std::string >, std::vector< double >>> vecpair_type