本文整理汇总了C++中NodeSet::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeSet::empty方法的具体用法?C++ NodeSet::empty怎么用?C++ NodeSet::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeSet
的用法示例。
在下文中一共展示了NodeSet::empty方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deep
void
step(DhtRunner& dht, std::atomic_uint& done, std::shared_ptr<NodeSet> all_nodes, dht::InfoHash cur_h, unsigned cur_depth)
{
std::cout << "step at " << cur_h << ", depth " << cur_depth << std::endl;
done++;
dht.get(cur_h, [all_nodes](const std::vector<std::shared_ptr<Value>>& /*values*/) {
return true;
}, [&,all_nodes,cur_h,cur_depth](bool, const std::vector<std::shared_ptr<Node>>& nodes) {
all_nodes->insert(nodes.begin(), nodes.end());
NodeSet sbuck {nodes.begin(), nodes.end()};
if (not sbuck.empty()) {
unsigned bdepth = sbuck.size()==1 ? 0u : InfoHash::commonBits((*sbuck.begin())->id, (*std::prev(sbuck.end()))->id);
unsigned target_depth = std::min(159u, bdepth+3u);
std::cout << cur_h << " : " << nodes.size() << " nodes; target is " << target_depth << " bits deep (cur " << cur_depth << ")" << std::endl;
for (unsigned b = cur_depth ; b < target_depth; b++) {
auto new_h = cur_h;
new_h.setBit(b, 1);
step(dht, done, all_nodes, new_h, b+1);
}
}
done--;
std::cout << done.load() << " operations left, " << all_nodes->size() << " nodes found." << std::endl;
cv.notify_one();
});
}
示例2: getDeclaration
ElementDeclaration* DeclarationFactory::getDeclaration(Element* element__)
{
ElementDeclaration* resultElement;
string elementName_ = element__->get_attribute_value("name");
NodeSet elementTypeSet = element__->find("@type");
if(!elementTypeSet.empty())
{
FE_TRACE(__F(("DeclarationFactory::getDeclaration - Getting declaration for element %1%") % elementName_));
//we're getting an attribute type back, see xpath for @
Attribute* typeAttr = polymorphic_downcast<Attribute*>(elementTypeSet.front());
FE_TRACE(__F(("DeclarationFactory::getDeclaration - Element has type %1%") % typeAttr->get_value()));
//checking if type is a basic type defined by the xsd definition
//type should start with xs: if this is the namespace used for the xml schema definition
if(typeAttr->get_value().substr(0, 3) == "xs:")
{
resultElement = new ElementDeclaration(
elementName_,
elementName_,
createSimpleBaseTypeDeclaration(typeAttr->get_value())
);
} else {
NodeSet typeSet = element__->find("//*[@name='"+typeAttr->get_value()+"']");
//shouldn't have to check if empty, otherwise invalid xsd
Element* typeElement_ = polymorphic_downcast<Element*>(typeSet.front());
resultElement = createCustomTypeElementDeclaration(element__, typeElement_);
}
} else
{
FE_TRACE("DeclarationFactory::getDeclaration - Couldn't find attribute type so must be anonymous type");
//this means it's probably an anonymous type
//first element should be the type
//no children and no type attribute should invalid, so we can assume it has children
NodeSet nodeSet = element__->find("*");
Element* typeElement_ = polymorphic_downcast<Element*>(nodeSet.front());
FE_TRACE(__F(("DeclarationFactory::getDeclaration - Tag name of the first child is %1%") % typeElement_->get_name() ));
resultElement = createCustomTypeElementDeclaration(element__, typeElement_);
}
int minOccurs = 0;
int maxOccurs = 1;
string minOccursString = element__->get_attribute_value("minOccurs");
string maxOccursString = element__->get_attribute_value("maxOccurs");
if(maxOccursString == "unbounded"){ maxOccurs = INT_MAX; }
else if (!maxOccursString.empty()) { maxOccurs = atoi(maxOccursString.c_str());}
minOccurs = atoi(minOccursString.c_str());
FE_TRACE(__F(("DeclarationFactory::getDeclaration - Setting maxOccurs to %1%") % maxOccurs));
FE_TRACE(__F(("DeclarationFactory::getDeclaration - Setting minOccurs to %1%") % minOccurs));
resultElement->setMaxOccurs(maxOccurs);
resultElement->setMinOccurs(minOccurs);
return resultElement;
}
示例3: getElementDeclaration
ElementDeclaration* XSDGuru::getElementDeclaration(string elementName__){
Element* rootElement = xsdParser.get_document()->get_root_node();
NodeSet elementDefinitionSet = rootElement->find("//*[local-name() = 'element' and @name='"+elementName__+"']");
if(!elementDefinitionSet.empty()){
Element* element_ = polymorphic_downcast<Element*>(elementDefinitionSet.front());
string elementName_ = element_->get_attribute_value("name");
if(!declarationCache.count(elementName_)){
unique_ptr<ElementDeclaration> elementShared_(DeclarationFactory::getDeclaration(element_));
declarationCache.insert( std::pair<string, unique_ptr<ElementDeclaration> >( elementName_, std::move(elementShared_) ) );
}
return declarationCache[elementName_].get();
} else {
FE_ERROR(__F(("XSDGuru::getElementDeclaration - Element with name %1% could not be found.") % elementName__));
}
//return default constructor
return 0;
}
示例4: rootNodes
DeclarationSet XSDGuru::rootNodes(){
DeclarationSet rootNodes_;
Element* rootElement = xsdParser.get_document()->get_root_node();
NodeSet rootNodeSet = rootElement->find("*[local-name() = 'element']");
if(!rootNodeSet.empty()){
for(Node* n : rootNodeSet){
Element* element_ = polymorphic_downcast<Element*>(n);
string elementName_ = element_->get_attribute_value("name");
if(!declarationCache.count(elementName_)) {
unique_ptr<ElementDeclaration> elementShared_( DeclarationFactory::getDeclaration(element_) );
declarationCache.insert( std::pair<string, unique_ptr<ElementDeclaration> >( elementName_, std::move(elementShared_) ) );
}
rootNodes_.push_back( declarationCache[elementName_].get() );
}
}
return rootNodes_;
}
示例5: part_1
void part_1()
{
// topological sort with an ordered set
NodeSet roots;
Graph children, parents;
get_graphs("input.txt", children, parents, roots);
stringstream res;
while (!roots.empty()) {
char n = *roots.begin();
roots.erase(roots.begin());
res << n;
for (char m : children[n]) {
parents[m].erase(n);
if (parents[m].empty()) {
roots.insert(m);
}
}
children.erase(n);
}
cout << res.str() << endl;
}
示例6: common
void HexagonCommonGEP::common() {
// The essence of this commoning is finding gep nodes that are equal.
// To do this we need to compare all pairs of nodes. To save time,
// first, partition the set of all nodes into sets of potentially equal
// nodes, and then compare pairs from within each partition.
using NodeSetMap = std::map<unsigned, NodeSet>;
NodeSetMap MaybeEq;
for (NodeVect::iterator I = Nodes.begin(), E = Nodes.end(); I != E; ++I) {
GepNode *N = *I;
unsigned H = node_hash(N);
MaybeEq[H].insert(N);
}
// Compute the equivalence relation for the gep nodes. Use two caches,
// one for equality and the other for non-equality.
NodeSymRel EqRel; // Equality relation (as set of equivalence classes).
NodePairSet Eq, Ne; // Caches.
for (NodeSetMap::iterator I = MaybeEq.begin(), E = MaybeEq.end();
I != E; ++I) {
NodeSet &S = I->second;
for (NodeSet::iterator NI = S.begin(), NE = S.end(); NI != NE; ++NI) {
GepNode *N = *NI;
// If node already has a class, then the class must have been created
// in a prior iteration of this loop. Since equality is transitive,
// nothing more will be added to that class, so skip it.
if (node_class(N, EqRel))
continue;
// Create a new class candidate now.
NodeSet C;
for (NodeSet::iterator NJ = std::next(NI); NJ != NE; ++NJ)
if (node_eq(N, *NJ, Eq, Ne))
C.insert(*NJ);
// If Tmp is empty, N would be the only element in it. Don't bother
// creating a class for it then.
if (!C.empty()) {
C.insert(N); // Finalize the set before adding it to the relation.
std::pair<NodeSymRel::iterator, bool> Ins = EqRel.insert(C);
(void)Ins;
assert(Ins.second && "Cannot add a class");
}
}
}
LLVM_DEBUG({
dbgs() << "Gep node equality:\n";
for (NodePairSet::iterator I = Eq.begin(), E = Eq.end(); I != E; ++I)
dbgs() << "{ " << I->first << ", " << I->second << " }\n";
dbgs() << "Gep equivalence classes:\n";
for (NodeSymRel::iterator I = EqRel.begin(), E = EqRel.end(); I != E; ++I) {
dbgs() << '{';
const NodeSet &S = *I;
for (NodeSet::const_iterator J = S.begin(), F = S.end(); J != F; ++J) {
if (J != S.begin())
dbgs() << ',';
dbgs() << ' ' << *J;
}
dbgs() << " }\n";
}
});
示例7: generateConstraints
void generateConstraints(vector<Node*>& nodes, vector<Edge*>& edges,vector<SimpleConstraint*>& cs,Dim dim) {
unsigned nevents=2*nodes.size()+2*edges.size();
events=new Event*[nevents];
unsigned ctr=0;
if(dim==HORIZONTAL) {
//cout << "Scanning top to bottom..." << endl;
for(unsigned i=0;i<nodes.size();i++) {
Node *v=nodes[i];
v->scanpos=v->x;
events[ctr++]=new Event(Open,v,v->ymin+0.01);
events[ctr++]=new Event(Close,v,v->ymax-0.01);
}
for(unsigned i=0;i<edges.size();i++) {
Edge *e=edges[i];
events[ctr++]=new Event(Open,e,e->ymin-1);
events[ctr++]=new Event(Close,e,e->ymax+1);
}
} else {
//cout << "Scanning left to right..." << endl;
for(unsigned i=0;i<nodes.size();i++) {
Node *v=nodes[i];
v->scanpos=v->y;
events[ctr++]=new Event(Open,v,v->xmin+0.01);
events[ctr++]=new Event(Close,v,v->xmax-0.01);
}
for(unsigned i=0;i<edges.size();i++) {
Edge *e=edges[i];
events[ctr++]=new Event(Open,e,e->xmin-1);
events[ctr++]=new Event(Close,e,e->xmax+1);
}
}
qsort((Event*)events, (size_t)nevents, sizeof(Event*), compare_events );
NodeSet openNodes;
vector<Edge*> openEdges;
for(unsigned i=0;i<nevents;i++) {
Event *e=events[i];
Node *v=e->v;
if(v!=NULL) {
v->open = true;
//printf("[email protected]%f,nid=%d,(%f,%f),w=%f,h=%f,openn=%d,opene=%d\n",e->pos,v->id,v->x,v->y,v->width,v->height,(int)openNodes.size(),(int)openEdges.size());
Node *l=NULL, *r=NULL;
if(!openNodes.empty()) {
// it points to the first node to the right of v
NodeSet::iterator it=openNodes.lower_bound(v);
// step left to find the first node to the left of v
if(it--!=openNodes.begin()) {
l=*it;
//printf("l=%d\n",l->id);
}
it=openNodes.upper_bound(v);
if(it!=openNodes.end()) {
r=*it;
}
}
vector<Node*> L;
sortNeighbours(v,l,r,e->pos,openEdges,L,nodes,dim);
//printf("L=[");
for(unsigned i=0;i<L.size();i++) {
//printf("%d ",L[i]->id);
}
//printf("]\n");
// Case A: create constraints between adjacent edges skipping edges joined
// to l,v or r.
Node* lastNode=NULL;
for(vector<Node*>::iterator i=L.begin();i!=L.end();i++) {
if((*i)->dummy) {
// node is on an edge
Edge *edge=(*i)->edge;
if(!edge->isEnd(v->id)
&&((l!=NULL&&!edge->isEnd(l->id))||l==NULL)
&&((r!=NULL&&!edge->isEnd(r->id))||r==NULL)) {
if(lastNode!=NULL) {
//printf(" Rule A: Constraint: v%d +g <= v%d\n",lastNode->id,(*i)->id);
cs.push_back(createConstraint(lastNode,*i,dim));
}
lastNode=*i;
}
} else {
// is an actual node
lastNode=NULL;
}
}
// Case B: create constraints for all the edges connected to the right of
// their own end, also in the scan line
vector<Node*> skipList;
lastNode=NULL;
for(vector<Node*>::iterator i=L.begin();i!=L.end();i++) {
if((*i)->dummy) {
// node is on an edge
if(lastNode!=NULL) {
if((*i)->edge->isEnd(lastNode->id)) {
skipList.push_back(*i);
} else {
for(vector<Node*>::iterator j=skipList.begin();
j!=skipList.end();j++) {
//printf(" Rule B: Constraint: v%d +g <= v%d\n",(*j)->id,(*i)->id);
cs.push_back(createConstraint(*j,*i,dim));
}
//.........这里部分代码省略.........
示例8: wDestructible
/*
* Checks if the pixel at pixelPosition is wDestructible or not. If it is,
* the a pointer to the node this pixel should point to is returned, otherwise,
* 0 es returned.
*/
Node* wDestructible(const Image& image, ComponentTree& componentTree,
unsigned int pixelPosition, PIXEL_TYPE& type)
{
type = MINIMUM;
NodeSet nodesFromNeighbor;
set<unsigned int> neighbors = image.getLowerNeighbors(pixelPosition);
for (auto& neighbor : neighbors)
{
nodesFromNeighbor.insert(componentTree.getComponent(neighbor));
}
if (nodesFromNeighbor.empty())
{
Node* n = componentTree.getComponent(pixelPosition);
if(componentTree.isLeaf(n))
{
type = MINIMUM;
}
else
{
type = PLATEAU;
}
return 0;
}
if (1 == nodesFromNeighbor.size())
{
Node* n = *(nodesFromNeighbor.begin());
if(componentTree.isLeaf(n))
{
type = FUTURE_MINIMUM;
}
else
{
type = FUTURE_PLATEAU;
}
return n;
}
Node* highestFork = componentTree.getHighestFork(nodesFromNeighbor);
if (!highestFork)
{
Node* n = componentTree.getMinimum(nodesFromNeighbor);
if(componentTree.isLeaf(n))
{
type = FUTURE_MINIMUM;
}
else
{
type = FUTURE_PLATEAU;
}
return n;
}
if (highestFork->getLevel() <= image.at(pixelPosition))
{
type = FUTURE_SEPARATING;
return highestFork;
}
type = SEPARATING;
return 0;
}
示例9: ATTR
void InterpreterDraft6::mainEventLoop() {
monIter_t monIter;
while(_running) {
NodeSet<std::string> enabledTransitions;
_stable = false;
// Here we handle eventless transitions and transitions
// triggered by internal events until machine is stable
while(_running && !_stable) {
#if VERBOSE
std::cout << "Configuration: ";
for (int i = 0; i < _configuration.size(); i++) {
std::cout << ATTR(_configuration[i], "id") << ", ";
}
std::cout << std::endl;
#endif
enabledTransitions = selectEventlessTransitions();
if (enabledTransitions.size() == 0) {
if (_internalQueue.size() == 0) {
_stable = true;
} else {
_currEvent = _internalQueue.front();
_internalQueue.pop_front();
#if VERBOSE
std::cout << "Received internal event " << _currEvent.name << std::endl;
#endif
// --- MONITOR: beforeProcessingEvent ------------------------------
for(monIter_t monIter = _monitors.begin(); monIter != _monitors.end(); monIter++) {
try {
(*monIter)->beforeProcessingEvent(shared_from_this(), _currEvent);
}
USCXML_MONITOR_CATCH_BLOCK(beforeProcessingEvent)
}
if (_dataModel)
_dataModel.setEvent(_currEvent);
enabledTransitions = selectTransitions(_currEvent.name);
}
}
if (!enabledTransitions.empty()) {
// test 403b
enabledTransitions.to_document_order();
microstep(enabledTransitions);
}
}
for (unsigned int i = 0; i < _statesToInvoke.size(); i++) {
NodeSet<std::string> invokes = filterChildElements(_nsInfo.xmlNSPrefix + "invoke", _statesToInvoke[i]);
for (unsigned int j = 0; j < invokes.size(); j++) {
if (!HAS_ATTR(invokes[j], "persist") || !DOMUtils::attributeIsTrue(ATTR(invokes[j], "persist"))) {
invoke(invokes[j]);
}
}
}
_statesToInvoke = NodeSet<std::string>();
if (!_internalQueue.empty())
continue;
// assume that we have a legal configuration as soon as the internal queue is empty
assert(hasLegalConfiguration());
monIter = _monitors.begin();
// --- MONITOR: onStableConfiguration ------------------------------
for(monIter_t monIter = _monitors.begin(); monIter != _monitors.end(); monIter++) {
try {
(*monIter)->onStableConfiguration(shared_from_this());
}
USCXML_MONITOR_CATCH_BLOCK(onStableConfiguration)
}
_mutex.unlock();
// whenever we have a stable configuration, run the mainThread hooks with 200fps
while(_externalQueue.isEmpty() && _thread == NULL) {
runOnMainThread(200);
}
_mutex.lock();
while(_externalQueue.isEmpty()) {
_condVar.wait(_mutex);
}
_currEvent = _externalQueue.pop();
#if VERBOSE
std::cout << "Received externalEvent event " << _currEvent.name << std::endl;
if (_running && _currEvent.name == "unblock.and.die") {
std::cout << "Still running " << this << std::endl;
} else {
std::cout << "Aborting " << this << std::endl;
}
#endif
_currEvent.eventType = Event::EXTERNAL; // make sure it is set to external
if (!_running)
goto EXIT_INTERPRETER;
// --- MONITOR: beforeProcessingEvent ------------------------------
//.........这里部分代码省略.........
示例10: getDocumentInitialTransitions
// process transitions until we are in a stable configuration again
void InterpreterDraft6::stabilize() {
monIter_t monIter;
NodeSet<std::string> enabledTransitions;
_stable = false;
if (_configuration.size() == 0) {
// goto initial configuration
NodeSet<std::string> initialTransitions = getDocumentInitialTransitions();
assert(initialTransitions.size() > 0);
enterStates(initialTransitions);
}
do { // process microsteps for enabled transitions until there are no more left
enabledTransitions = selectEventlessTransitions();
if (enabledTransitions.size() == 0) {
if (_internalQueue.size() == 0) {
_stable = true;
} else {
_currEvent = _internalQueue.front();
_internalQueue.pop_front();
#if VERBOSE
std::cout << "Received internal event " << _currEvent.name << std::endl;
#endif
// --- MONITOR: beforeProcessingEvent ------------------------------
for(monIter_t monIter = _monitors.begin(); monIter != _monitors.end(); monIter++) {
try {
(*monIter)->beforeProcessingEvent(shared_from_this(), _currEvent);
}
USCXML_MONITOR_CATCH_BLOCK(beforeProcessingEvent)
}
if (_dataModel)
_dataModel.setEvent(_currEvent);
enabledTransitions = selectTransitions(_currEvent.name);
}
}
if (!enabledTransitions.empty()) {
// test 403b
enabledTransitions.to_document_order();
microstep(enabledTransitions);
}
} while(!_internalQueue.empty() || !_stable);
monIter = _monitors.begin();
// --- MONITOR: onStableConfiguration ------------------------------
for(monIter_t monIter = _monitors.begin(); monIter != _monitors.end(); monIter++) {
try {
(*monIter)->onStableConfiguration(shared_from_this());
}
USCXML_MONITOR_CATCH_BLOCK(onStableConfiguration)
}
// when we reach a stable configuration, invoke
for (unsigned int i = 0; i < _statesToInvoke.size(); i++) {
NodeSet<std::string> invokes = filterChildElements(_nsInfo.xmlNSPrefix + "invoke", _statesToInvoke[i]);
for (unsigned int j = 0; j < invokes.size(); j++) {
if (!HAS_ATTR(invokes[j], "persist") || !DOMUtils::attributeIsTrue(ATTR(invokes[j], "persist"))) {
invoke(invokes[j]);
}
}
}
_statesToInvoke = NodeSet<std::string>();
}
示例11: catch
// a macrostep
InterpreterState InterpreterDraft6::step(bool blocking) {
try {
monIter_t monIter;
NodeSet<std::string> enabledTransitions;
// setup document and interpreter
if (!_isInitialized)
init();
// if we failed return false
if (!_isInitialized)
return INIT_FAILED;
// run initial transitions
if (!_stable) {
stabilize();
// we might only need a single step
if (!_running)
goto EXIT_INTERPRETER;
return INITIALIZED;
}
if (!_running)
return FINISHED;
// read an external event and react
if (blocking) {
// wait until an event becomes available
while(_externalQueue.isEmpty()) {
_condVar.wait(_mutex);
}
} else {
// return immediately if external queue is empty
if (_externalQueue.isEmpty())
return NOTHING_TODO;
}
_currEvent = _externalQueue.pop();
#if VERBOSE
std::cout << "Received externalEvent event " << _currEvent.name << std::endl;
if (_running && _currEvent.name == "unblock.and.die") {
std::cout << "Still running " << this << std::endl;
} else {
std::cout << "Aborting " << this << std::endl;
}
#endif
_currEvent.eventType = Event::EXTERNAL; // make sure it is set to external
// when we were blocking on destructor invocation
if (!_running) {
goto EXIT_INTERPRETER;
return INTERRUPTED;
}
// --- MONITOR: beforeProcessingEvent ------------------------------
for(monIter_t monIter = _monitors.begin(); monIter != _monitors.end(); monIter++) {
try {
(*monIter)->beforeProcessingEvent(shared_from_this(), _currEvent);
}
USCXML_MONITOR_CATCH_BLOCK(beforeProcessingEvent)
}
if (iequals(_currEvent.name, "cancel.invoke." + _sessionId))
return INTERRUPTED;
try {
_dataModel.setEvent(_currEvent);
} catch (Event e) {
LOG(ERROR) << "Syntax error while setting external event:" << std::endl << e << std::endl << _currEvent;
}
for (std::map<std::string, Invoker>::iterator invokeIter = _invokers.begin();
invokeIter != _invokers.end();
invokeIter++) {
if (iequals(invokeIter->first, _currEvent.invokeid)) {
Arabica::XPath::NodeSet<std::string> finalizes = filterChildElements(_nsInfo.xmlNSPrefix + "finalize", invokeIter->second.getElement());
for (int k = 0; k < finalizes.size(); k++) {
Element<std::string> finalizeElem = Element<std::string>(finalizes[k]);
executeContent(finalizeElem);
}
}
if (HAS_ATTR(invokeIter->second.getElement(), "autoforward") && DOMUtils::attributeIsTrue(ATTR(invokeIter->second.getElement(), "autoforward"))) {
try {
// do not autoforward to invokers that send to #_parent from the SCXML IO Processor!
// Yes do so, see test229!
// if (!boost::equals(_currEvent.getOriginType(), "http://www.w3.org/TR/scxml/#SCXMLEventProcessor"))
invokeIter->second.send(_currEvent);
} catch(...) {
LOG(ERROR) << "Exception caught while sending event to invoker " << invokeIter->first;
}
}
}
// run internal processing until we reach a stable configuration again
enabledTransitions = selectTransitions(_currEvent.name);
if (!enabledTransitions.empty()) {
// test 403b
enabledTransitions.to_document_order();
//.........这里部分代码省略.........
示例12: extractEnumValues
DoubleDeclaration::DoubleDeclaration(Element* typeDeclaration__) :
NumericDeclaration<double>(typeDeclaration__->get_attribute_value("name"))
{
//extract info with xpath's
//enumeration
vector<string> enumStrings_ = extractEnumValues(typeDeclaration__);
vector<double> enumValues_;
for(string s : enumStrings_ )
{
try {
double tmp = lexical_cast<double>(s);
enumValues_.push_back(tmp);
} catch(bad_lexical_cast const& ){
continue;
}
}
setEnumValues(enumValues_);
//pattern
setPattern(extractPattern(typeDeclaration__));
//min value
string min_ = extractMin(typeDeclaration__);
try {
double tmp = lexical_cast<double>(min_);
setMin(tmp);
} catch(bad_lexical_cast const& ){
setMin(DBL_MIN);
}
//max value
string max_ = extractMax(typeDeclaration__);
try {
double tmp = lexical_cast<double>(max_);
setMax(tmp);
} catch(bad_lexical_cast const& ){
setMax(DBL_MAX);
}
//total digits
//probably won't be used just yet
string totalDigits_ = extractTotalDigits(typeDeclaration__);
try {
int tmp = lexical_cast<int>(totalDigits_);
setTotalDigits(tmp);
} catch(bad_lexical_cast const& ){
setTotalDigits(DBL_DIG+DBL_MAX_10_EXP);
}
//double specific precision
NodeSet precisionValueSet = typeDeclaration__->find(".//*[local-name() = 'fractionDigits']/@value");
int precision_;
if(!precisionValueSet.empty())
{
Attribute* attr = polymorphic_downcast<Attribute*>(precisionValueSet.front());
try {
string tmp = attr->get_value();
precision_ = lexical_cast<int>(tmp);
setPrecision(precision_);
} catch(bad_lexical_cast const& ){
setPrecision(DBL_DIG);
}
}
}