lcdd/src
diff -u -r1.3 -r1.4
--- IdSpec.cc 8 Feb 2005 03:20:40 -0000 1.3
+++ IdSpec.cc 20 Jul 2006 21:07:54 -0000 1.4
@@ -1,6 +1,10 @@
-// $Header: /cvs/lcd/lcdd/src/IdSpec.cc,v 1.3 2005/02/08 03:20:40 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/IdSpec.cc,v 1.4 2006/07/20 21:07:54 jeremy Exp $
+
#include "IdSpec.hh"
+// STL
+#include <sstream>
+
using namespace std;
void IdSpec::printOut(std::ostream& os) const
@@ -13,7 +17,7 @@
static const int def_width = 15;
os.width(def_width);
- os << left << "label";
+ os << left << "label";
os.width(def_width);
os << left << "start";
@@ -62,3 +66,27 @@
os << std::endl;
}
+
+std::string IdSpec::getFieldDescription()
+{
+ std::stringstream enc;
+
+ // Loop over the fields in the IdSpec.
+ for (IdSpec::IdFields::const_iterator it = this->IdFieldsBegin();
+ it != this->IdFieldsEnd();
+ it++) {
+
+ // Get the IdField.
+ IdField* field = (*it);
+
+ // Encode the field information into the LCIO / compact format.
+ enc << field->getLabel() << ":" << field->getStart() << ":";
+ if (field->getSigned() ) {
+ enc << "-";
+ }
+ enc << field->getLength() << ",";
+ }
+
+ // Return the id description string, eliminating last comma.
+ return enc.str().substr(0, enc.str().length() - 1);
+}
lcdd/include
diff -u -r1.6 -r1.7
--- IdSpec.hh 20 Apr 2005 19:04:40 -0000 1.6
+++ IdSpec.hh 20 Jul 2006 21:07:54 -0000 1.7
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/IdSpec.hh,v 1.6 2005/04/20 19:04:40 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/IdSpec.hh,v 1.7 2006/07/20 21:07:54 jeremy Exp $
#ifndef IdSpec_hh
#define IdSpec_hh 1
@@ -25,7 +25,7 @@
typedef std::vector<IdField*> IdFields;
public:
- IdSpec()
+ IdSpec()
{}
virtual ~IdSpec()
@@ -114,11 +114,11 @@
void printOut(std::ostream& os) const;
+ std::string getFieldDescription();
+
private:
std::string m_name;
-
SizeType m_bitLength;
-
IdFields m_idFields;
};