summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/element.cpp11
-rw-r--r--lib/gras_impl/debug.hpp1
-rw-r--r--lib/gras_impl/output_buffer_queues.hpp2
-rw-r--r--lib/pmc_to_ptree.cpp72
-rw-r--r--lib/task_done.cpp2
-rw-r--r--lib/top_block.cpp10
6 files changed, 50 insertions, 48 deletions
diff --git a/lib/element.cpp b/lib/element.cpp
index 2de0ffb..008027c 100644
--- a/lib/element.cpp
+++ b/lib/element.cpp
@@ -34,7 +34,11 @@ Element::Element(const std::string &name)
}
(*this)->repr = str(boost::format("%s (%u)") % name % which);
- if (GENESIS) std::cerr << "New element: " << to_string() << std::endl;
+ if (GENESIS) std::cerr
+ << "===================================================\n"
+ << "== Element Created: " << to_string() << "\n"
+ << "===================================================\n"
+ << std::flush;
}
Element::~Element(void)
@@ -57,6 +61,11 @@ ElementImpl::~ElementImpl(void)
if (this->executor) this->top_block_cleanup();
if (this->topology) this->hier_block_cleanup();
if (this->worker) this->block_cleanup();
+ if (ARMAGEDDON) std::cerr
+ << "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"
+ << "xx Element Destroyed: " << name << "\n"
+ << "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"
+ << std::flush;
}
void Element::set_container(WeakContainer *container)
diff --git a/lib/gras_impl/debug.hpp b/lib/gras_impl/debug.hpp
index eb09090..d356987 100644
--- a/lib/gras_impl/debug.hpp
+++ b/lib/gras_impl/debug.hpp
@@ -20,6 +20,7 @@ extern void *operator new(std::size_t n) throw (std::bad_alloc);
//----------------------------------------------------------------------
#define GENESIS 0
#define ARMAGEDDON 0
+#define DONE_PRINTS 0
//----------------------------------------------------------------------
//-- define to enable these debugs:
diff --git a/lib/gras_impl/output_buffer_queues.hpp b/lib/gras_impl/output_buffer_queues.hpp
index 48d54de..540a5c2 100644
--- a/lib/gras_impl/output_buffer_queues.hpp
+++ b/lib/gras_impl/output_buffer_queues.hpp
@@ -127,7 +127,7 @@ struct OutputBufferQueues
if (_queues[i] and not _queues[i]->empty())
{
const SBuffer &front = _queues[i]->front();
- const size_t avail = front.get_actual_length() - front.offset - front.length;
+ const size_t avail = front.get_actual_length() - front.offset - front.length;
_bitset.set(i, avail >= _reserve_bytes[i]);
}
else
diff --git a/lib/pmc_to_ptree.cpp b/lib/pmc_to_ptree.cpp
index 6565fa6..a53261d 100644
--- a/lib/pmc_to_ptree.cpp
+++ b/lib/pmc_to_ptree.cpp
@@ -8,7 +8,6 @@
#include <boost/foreach.hpp>
#include <vector>
#include <complex>
-#include <sstream>
using namespace boost::property_tree;
@@ -34,13 +33,16 @@ PMCC gras::ptree_to_pmc(const ptree &value, const std::type_info &hint)
//array
else
{
- //TODO more if statements - w/ define
- return ptree_to_pmc(value, typeid(std::vector<double>));
+ try{return ptree_to_pmc(value, typeid(std::vector<std::complex<double> >));}
+ catch(...){}
+
+ try{return ptree_to_pmc(value, typeid(std::vector<double>));}
+ catch(...){}
}
}
#define ptree_to_pmc_try(type) \
- if (hint == typeid(type)) return PMC_M(value.get_value<type>());
+ if (hint == typeid(type)) return PMC_M(value.get_value<type >());
//determine number
ptree_to_pmc_try(char);
@@ -56,28 +58,38 @@ PMCC gras::ptree_to_pmc(const ptree &value, const std::type_info &hint)
ptree_to_pmc_try(unsigned long long);
ptree_to_pmc_try(float);
ptree_to_pmc_try(double);
-
- //complex number
- std::istringstream ss(value.get_value<std::string>());
- if (hint == typeid(std::complex<double>))
- {
- std::complex<double> c; ss >> c; return PMC_M(c);
- }
- if (hint == typeid(std::complex<float>))
- {
- std::complex<float> c; ss >> c; return PMC_M(c);
- }
+ ptree_to_pmc_try(std::complex<float>);
+ ptree_to_pmc_try(std::complex<double>);
//string
ptree_to_pmc_try(std::string);
//determine number vector
- std::vector<long> vec;
- BOOST_FOREACH(const ptree::value_type &elem, value)
- {
- vec.push_back(elem.second.get_value<long>());
+ #define ptree_to_pmc_tryv(type) \
+ if (hint == typeid(std::vector<type >)) \
+ { \
+ std::vector<type > vec; \
+ BOOST_FOREACH(const ptree::value_type &elem, value) \
+ { \
+ vec.push_back(elem.second.get_value<type >()); \
+ } \
+ return PMC_M(vec); \
}
- return PMC_M(vec);
+ ptree_to_pmc_tryv(char);
+ ptree_to_pmc_tryv(signed char);
+ ptree_to_pmc_tryv(unsigned char);
+ ptree_to_pmc_tryv(signed short);
+ ptree_to_pmc_tryv(unsigned short);
+ ptree_to_pmc_tryv(signed int);
+ ptree_to_pmc_tryv(unsigned int);
+ ptree_to_pmc_tryv(signed long);
+ ptree_to_pmc_tryv(unsigned long);
+ ptree_to_pmc_tryv(signed long long);
+ ptree_to_pmc_tryv(unsigned long long);
+ ptree_to_pmc_tryv(float);
+ ptree_to_pmc_tryv(double);
+ ptree_to_pmc_tryv(std::complex<float>);
+ ptree_to_pmc_tryv(std::complex<double>);
//otherwise null -- will crap out
return PMC();
@@ -87,7 +99,7 @@ ptree gras::pmc_to_ptree(const PMCC &value)
{
ptree v;
#define pmc_to_ptree_try(type) \
- if (value.is<type>()) {v.put_value(value.as<type>()); return v;}
+ if (value.is<type >()) {v.put_value(value.as<type >()); return v;}
//determine number
pmc_to_ptree_try(char);
@@ -103,20 +115,8 @@ ptree gras::pmc_to_ptree(const PMCC &value)
pmc_to_ptree_try(unsigned long long);
pmc_to_ptree_try(float);
pmc_to_ptree_try(double);
-
- //derermine complex
- if (value.is<std::complex<double> >())
- {
- std::ostringstream oss;
- oss << value.as<std::complex<double> >();
- v.put_value(oss.str()); return v;
- }
- if (value.is<std::complex<float> >())
- {
- std::ostringstream oss;
- oss << value.as<std::complex<float> >();
- v.put_value(oss.str()); return v;
- }
+ pmc_to_ptree_try(std::complex<float>);
+ pmc_to_ptree_try(std::complex<double>);
//determine string
pmc_to_ptree_try(std::string);
@@ -144,6 +144,8 @@ ptree gras::pmc_to_ptree(const PMCC &value)
pmc_to_ptree_tryv(unsigned long long);
pmc_to_ptree_tryv(float);
pmc_to_ptree_tryv(double);
+ pmc_to_ptree_tryv(std::complex<float>);
+ pmc_to_ptree_tryv(std::complex<double>);
return v;
}
diff --git a/lib/task_done.cpp b/lib/task_done.cpp
index f25810e..87129ea 100644
--- a/lib/task_done.cpp
+++ b/lib/task_done.cpp
@@ -62,7 +62,7 @@ void BlockActor::mark_done(void)
worker->post_downstream(i, InputCheckMessage());
}
- if (ARMAGEDDON) std::cerr
+ if (DONE_PRINTS) std::cerr
<< "==================================================\n"
<< "== The " << name << " is done...\n"
<< "==================================================\n"
diff --git a/lib/top_block.cpp b/lib/top_block.cpp
index 240f417..cf0fdaa 100644
--- a/lib/top_block.cpp
+++ b/lib/top_block.cpp
@@ -17,11 +17,6 @@ TopBlock::TopBlock(const std::string &name):
(*this)->executor.reset(new Apology::Executor((*this)->topology.get()));
(*this)->token = Token::make();
(*this)->thread_group = SharedThreadGroup(new boost::thread_group());
- if (GENESIS) std::cerr
- << "===================================================\n"
- << "== Top Block Created: " << name << "\n"
- << "===================================================\n"
- << std::flush;
}
TopBlock::~TopBlock(void)
@@ -34,11 +29,6 @@ void ElementImpl::top_block_cleanup(void)
this->bcast_prio_msg(TopInertMessage());
this->topology->clear_all();
this->executor->commit();
- if (ARMAGEDDON) std::cerr
- << "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"
- << "xx Top Block Destroyed: " << name << "\n"
- << "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"
- << std::flush;
}
const GlobalBlockConfig &TopBlock::global_config(void) const