Permalink
Browse files

Try to fix some voverity errors

  • Loading branch information...
MarkusFrankATcernch committed Aug 31, 2017
1 parent f8426ce commit c97f1820601b724acb21a87f5eaf6f32d2838ab7
@@ -72,7 +72,7 @@ namespace dd4hep {
/// Initializing constructor
AlignmentsCalib(Detector& description, ConditionsMap& mapping);
/// Default destructor
virtual ~AlignmentsCalib();
virtual ~AlignmentsCalib() noexcept(false);
/// No assignment operator
AlignmentsCalib& operator=(const AlignmentsCalib& copy) = delete;
/// No move assignment operator
@@ -116,7 +116,7 @@ namespace dd4hep {
void clearDeltas();
/// We clear the entire cached stack of used entries.
void clear();
void clear() noexcept(false);
/// Convenience only: Access detector element by path
DetElement detector(const std::string& path) const;
@@ -51,7 +51,7 @@ AlignmentsCalib::AlignmentsCalib(Detector& l, ConditionsMap& m) : description(l)
}
/// Default destructor
AlignmentsCalib::~AlignmentsCalib() {
AlignmentsCalib::~AlignmentsCalib() noexcept(false) {
clear();
}
@@ -124,7 +124,7 @@ void AlignmentsCalib::clearDeltas() {
}
/// Clear all pending entries in the working cache
void AlignmentsCalib::clear() {
void AlignmentsCalib::clear() noexcept(false) {
for(auto& e : used) {
e.second->source.get<Delta>() = e.second->delta;
detail::deletePtr(e.second);
@@ -73,6 +73,8 @@ namespace dd4hep {
/// Default destructor
virtual ~ConditionsDataLoader();
/// Add data source definition to loader
void addSource(const std::string& source);
/// Add data source definition to loader for data corresponding to a given IOV
void addSource(const std::string& source, const IOV& iov);
#if 0
/// Load a condition set given the conditions key according to their validity
@@ -39,6 +39,11 @@ void ConditionsDataLoader::addSource(const string& source, const IOV& iov) {
m_sources.push_back(make_pair(source,iov));
}
/// Add data source definition to loader
void ConditionsDataLoader::addSource(const string& source) {
m_sources.push_back(make_pair(source,IOV(0,0)));
}
/// Queue update to manager.
//Condition ConditionsDataLoader::queueUpdate(Entry* data) {
// return m_mgr->__queue_update(data);
@@ -157,22 +157,27 @@ namespace {
if ( in.good() ) {
if ( siz_tot ) {
// Direct access mode with fixed record size
text[8] = text[9+siz_nam] = text[10+siz_nam+siz_add] = 0;
e.name = text+9;
e.address = text+10+siz_nam;
if ( (idx=e.name.find(' ')) != string::npos )
e.name[idx] = 0;
if ( (idx=e.address.find(' ')) != string::npos )
e.address[idx] = 0;
if ( siz_nam+9 < (long)sizeof(text) ) {
text[8] = text[9+siz_nam] = text[10+siz_nam+siz_add] = 0;
e.name = text+9;
e.address = text+10+siz_nam;
if ( (idx=e.name.find(' ')) != string::npos && idx < e.name.length() )
e.name[idx] = 0;
if ( (idx=e.address.find(' ')) != string::npos && idx < e.address.length() )
e.address[idx] = 0;
}
else {
except("ConditionsRepository","+++ Invalid record encountered. [Sever error]");
}
}
else {
// Variable record size
e.name=text+9;
if ( (idx=e.name.find(sep)) != string::npos )
if ( (idx=e.name.find(sep)) != string::npos && idx < sizeof(text)-9 )
text[9+idx] = 0, e.address=text+idx+10, e.name=text+9;
if ( (idx=e.address.find(sep)) != string::npos )
if ( (idx=e.address.find(sep)) != string::npos && idx < e.address.length() )
e.address[idx] = 0;
else if ( (idx=e.address.find('\n')) != string::npos )
else if ( (idx=e.address.find('\n')) != string::npos && idx < e.address.length() )
e.address[idx] = 0;
}
size_t cap = data.capacity();
@@ -33,18 +33,8 @@ namespace dd4hep {
class NamedObject;
template <typename T> class Handle;
/// Namespace for the AIDA detector description toolkit supporting XML utilities
namespace xml {
//class Handle;
//class Collection_t;
//class Document;
//class Element;
}
/// Factory base class implementing some utilities
struct PluginFactoryBase {
//typedef xml::Handle_t xml_h;
//typedef xml::Element xml_e;
typedef std::string str_t;
template <typename T> static T* ptr(const T* _p) { return (T*)_p; }
@@ -74,7 +64,7 @@ namespace dd4hep {
/// Default constructor
PluginDebug(int dbg = 2) noexcept(false);
/// Default destructor
~PluginDebug();
~PluginDebug() noexcept(false);
/// Helper to check factory existence
std::string missingFactory(const std::string& name) const;
};
@@ -245,8 +235,5 @@ namespace dd4hep {
}; \
template <typename P> inline R Factory<P,R(A0,A1,A2,A3,A4)>::call(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4)
#endif /* __CINT__ */
#endif /* DD4HEP_PLUGINS_H */
View
@@ -23,11 +23,11 @@
using namespace std;
using namespace dd4hep;
const std::string dd4hep::align::Keys::deltaName("alignment_delta");
const string dd4hep::align::Keys::deltaName("alignment_delta");
const dd4hep::Condition::itemkey_type dd4hep::align::Keys::deltaKey =
dd4hep::ConditionKey::itemCode("alignment_delta");
const std::string dd4hep::align::Keys::alignmentName("alignment");
const string dd4hep::align::Keys::alignmentName("alignment");
const dd4hep::Condition::itemkey_type dd4hep::align::Keys::alignmentKey =
dd4hep::ConditionKey::itemCode("alignment");
@@ -77,7 +77,7 @@ const TGeoHMatrix& Alignment::detectorTransformation() const {
}
/// Access to the node list
const std::vector<PlacedVolume>& Alignment::nodes() const {
const vector<PlacedVolume>& Alignment::nodes() const {
return access()->values().nodes;
}
@@ -157,20 +157,17 @@ AlignmentCondition::key_type AlignmentCondition::key() const {
/// Data accessor for the use of decorators
AlignmentData& AlignmentCondition::data() {
Object* o = access();
return o->alignment_data ? *o->alignment_data : o->values();
return *(access()->alignment_data);
}
/// Data accessor for the use of decorators
const AlignmentData& AlignmentCondition::data() const {
Object* o = access();
return o->alignment_data ? *o->alignment_data : o->values();
return *(access()->alignment_data);
}
/// Access the delta value of the object
const Delta& AlignmentCondition::delta() const {
Object* o = access();
return (o->alignment_data ? *o->alignment_data : o->values()).delta;
return access()->alignment_data->delta;
}
/// Check if object is already bound....
@@ -24,8 +24,8 @@ using namespace std;
using namespace dd4hep;
using namespace dd4hep::detail;
DD4HEP_INSTANTIATE_HANDLE_NAMED(AlignmentObject,ConditionObject);
DD4HEP_INSTANTIATE_HANDLE_UNNAMED(AlignmentData);
DD4HEP_INSTANTIATE_HANDLE_NAMED(AlignmentObject,ConditionObject);
/// Default constructor
AlignmentObject::AlignmentObject()
@@ -39,7 +39,7 @@ AlignmentObject::AlignmentObject()
/// Standard constructor
AlignmentObject::AlignmentObject(const string& nam, const string& tit, void* p, size_t len)
: ConditionObject(nam, tit), alignment_data(0)//, source_key(0)
: ConditionObject(nam, tit), alignment_data(0)
{
InstanceCount::increment(this);
flags = Condition::ALIGNMENT_DERIVED|Condition::ONSTACK;
@@ -49,12 +49,12 @@ class ConditionsPrinter::ParamPrinter {
ConditionsPrinter* m_parent = 0;
public:
std::string prefix;
PrintLevel printLevel;
PrintLevel printLevel = INFO;
public:
/// Copy constructor
ParamPrinter(const ParamPrinter& copy) = default;
/// Initializing constructor
ParamPrinter(ConditionsPrinter* p);
ParamPrinter(ConditionsPrinter* p, PrintLevel lvl);
/// Default destructor
virtual ~ParamPrinter() = default;
/// Assignment operator
@@ -65,7 +65,9 @@ class ConditionsPrinter::ParamPrinter {
/// Initializing constructor
ConditionsPrinter::ParamPrinter::ParamPrinter(ConditionsPrinter* p) : m_parent(p) {
ConditionsPrinter::ParamPrinter::ParamPrinter(ConditionsPrinter* p, PrintLevel lvl)
: m_parent(p), printLevel(lvl)
{
}
/// Callback to output conditions information
@@ -112,8 +114,7 @@ void ConditionsPrinter::ParamPrinter::operator()(const AbstractMap::Params::valu
ConditionsPrinter::ConditionsPrinter(ConditionsMap* m, const string& pref, int flg)
: mapping(m), m_flag(flg), name("Condition"), prefix(pref)
{
m_print = new ParamPrinter(this);
m_print->printLevel = printLevel;
m_print = new ParamPrinter(this, printLevel);
}
/// Default destructor
View
@@ -49,7 +49,7 @@ PluginDebug::PluginDebug(int dbg)
}
/// Default destructor
PluginDebug::~PluginDebug() {
PluginDebug::~PluginDebug() noexcept(false) {
ROOT::Reflex::PluginService::SetDebug (m_debug);
}
@@ -140,7 +140,7 @@ PluginDebug::PluginDebug(int dbg) noexcept(false) : m_debug(0) {
}
/// Default destructor
PluginDebug::~PluginDebug() {
PluginDebug::~PluginDebug() noexcept(false) {
PluginInterface::instance().setDebug(m_debug);
}
@@ -63,7 +63,7 @@ DECLARE_APPLY(DDDB_PluginLevel,dddb_plugin_print_level)
namespace {
using namespace dd4hep::cond;
/// Basic entry point to print out the detector element hierarchy
/**
* \author M.Frank
@@ -75,7 +75,31 @@ namespace {
using align::deltaCollector;
using DDDB::DDDBCatalog;
/// Access the test's name
/**
* \author M.Frank
* \version 1.0
* \date 01/04/2014
*/
struct naming {
/// Access the name of the test
static const char* get(int flag) {
const char* n = "DDDBDetectorDump";
if ( flag == 1 )
n = "DDDBDetVolumeDump";
else if ( flag == 2 )
n = "DDDBDetConditionKeyDump";
else if ( flag == 3 )
n = "DDDBDetConditionDump";
else if ( flag == 4 )
n = "DDDBDetectorDump";
else if ( flag == 5 )
n = "DetElementConditionDump";
else if ( flag == 5 )
n = "DDDBDetectorDumpAll";
return n;
}
};
/// Callback object to print selective information
/**
* \author M.Frank
@@ -121,6 +145,7 @@ namespace {
m_alignPrinter(0,"DDDBAlignments"),
m_flag(flg), m_sensitivesOnly(sens), m_dumpConditions(dmp), m_detDesc(l)
{
m_name = naming::get(flg);
m_manager = ConditionsManager::from(m_detDesc);
m_slice.reset(new ConditionsSlice(m_manager,shared_ptr<ConditionsContent>(new ConditionsContent())));
m_detElementPrinter.printLevel = s_PrintLevel;
@@ -371,19 +396,6 @@ namespace {
}
}
DumpActor actor(description, flag, dump_sensitive_only, dump_all_cond);
actor.m_name = "DDDBDetectorDump";
if ( flag == 1 )
actor.m_name = "DDDBDetVolumeDump";
else if ( flag == 2 )
actor.m_name = "DDDBDetConditionKeyDump";
else if ( flag == 3 )
actor.m_name = "DDDBDetConditionDump";
else if ( flag == 4 )
actor.m_name = "DDDBDetectorDump";
else if ( flag == 5 )
actor.m_name = "DetElementConditionDump";
else if ( flag == 5 )
actor.m_name = "DDDBDetectorDumpAll";
printout(INFO,actor.m_name,"**************** DDDB Detector dump *****************************");
return actor.init().dump(description.world(), 0);
}
@@ -201,9 +201,11 @@ void Geant4ParticlePrint::printParticleTree(const G4Event* e,
::memset(txt+6,' ',len-6);
txt[len-1] = 0;
txt[len-2] = '>';
txt[level+6]='+';
::memset(txt+level+6+1,'-',len-level-3-6);
if ( size_t(level + 6) < len ) {
txt[level+6]='+';
::memset(txt+level+6+1,'-',len-level-3-6);
}
printParticle(txt, e, p);
const set<int>& daughters = p->daughters;
// For all particles, the set of daughters must be contained in the record.
Oops, something went wrong.

0 comments on commit c97f182

Please sign in to comment.