diff --git a/src/PLASMA/NDDL/component/Interpreter.cc b/src/PLASMA/NDDL/component/Interpreter.cc index 835d6befc..5ff203b42 100644 --- a/src/PLASMA/NDDL/component/Interpreter.cc +++ b/src/PLASMA/NDDL/component/Interpreter.cc @@ -2512,12 +2512,12 @@ void getVariableReferences(const Expr* expr, EvalContext& ctx, } //ExprVarDeclaration -> ? else if(dynamic_cast(expr) != NULL) { - dest.push_back(dynamic_cast(expr)->eval(ctx).getValue()); + dest.push_back(static_cast(expr)->eval(ctx).getValue()); } //ExprVarRef -> ? //ExprAssignment -> ? else if(dynamic_cast(expr) != NULL) { - const ExprConstraint* e = dynamic_cast(expr); + const ExprConstraint* e = static_cast(expr); std::vector args = e->getArgs(); for(std::vector::const_iterator it = args.begin(); it != args.end(); ++it) { @@ -2531,7 +2531,7 @@ void getVariableReferences(const Expr* expr, EvalContext& ctx, //ExprObjectTypeDefinition -> nothing //ExprRuleTypeDefinition -> nothing else if(dynamic_cast(expr) != NULL) { - const ExprMethodCall* e = dynamic_cast(expr); + const ExprMethodCall* e = static_cast(expr); for(std::vector::const_iterator it = e->getArgs().begin(); it != e->getArgs().end(); ++it) { checkError(*it != NULL, "Argument to method " << e->toString() << " is NULL."); @@ -2546,7 +2546,7 @@ void getVariableReferences(const Expr* expr, EvalContext& ctx, //ExprRelation -> ? else if(dynamic_cast(expr) != NULL) { if(dynamic_cast(expr) != NULL) { - const CExprFunction* e = dynamic_cast(expr); + const CExprFunction* e = static_cast(expr); std::vector args = e->getArgs(); for(std::vector::const_iterator it = args.begin(); it != args.end(); ++it) { @@ -2556,10 +2556,10 @@ void getVariableReferences(const Expr* expr, EvalContext& ctx, } else if(dynamic_cast(expr) != NULL) { //not sure this is right - dest.push_back(dynamic_cast(expr)->eval(ctx).getValue()); + dest.push_back(static_cast(expr)->eval(ctx).getValue()); } else if(dynamic_cast(expr) != NULL) { - const CExprBinary* e = dynamic_cast(expr); + const CExprBinary* e = static_cast(expr); checkError(e->getLhs() != NULL, "LHS for " << e->toString() << " is NULL."); checkError(e->getRhs() != NULL, "RHS for " << e->toString() << " is NULL."); getVariableReferences(e->getLhs(), ctx, dest); @@ -2574,7 +2574,7 @@ void getVariableReferences(const Expr* expr, EvalContext& ctx, } //RuleExpr -> ? else if(dynamic_cast(expr) != NULL) { - const ExprIfGuard* e = dynamic_cast(expr); + const ExprIfGuard* e = static_cast(expr); checkError(e->getLhs() != NULL, "LHS for " << e->toString() << " is NULL."); checkError(e->getRhs() != NULL, "RHS for " << e->toString() << " is NULL."); getVariableReferences(e->getLhs(), ctx, dest); diff --git a/src/PLASMA/PlanDatabase/base/Schema.cc b/src/PLASMA/PlanDatabase/base/Schema.cc index 35a1b574a..ec1cba13c 100644 --- a/src/PLASMA/PlanDatabase/base/Schema.cc +++ b/src/PLASMA/PlanDatabase/base/Schema.cc @@ -406,8 +406,12 @@ const std::set& Schema::getAllObjectTypes() const { membershipRelation.find(parentType); // At this point we know if we do not have a hit, then try a parent - if(membershipRelation_it == membershipRelation.end() && hasParent(parentType)) - return getMemberType(getParent(parentType), memberName); + if(membershipRelation_it == membershipRelation.end()) { + if(hasParent(parentType)) + return getMemberType(getParent(parentType), memberName); + else + return ""; + } // Alternately, we have to have a hit const NameValueVector& members = membershipRelation_it->second; @@ -421,7 +425,7 @@ const std::set& Schema::getAllObjectTypes() const { return getMemberType(getParent(parentType), memberName); } - unsigned int Schema::getIndexFromName(const std::string& parentType, const std::string& memberName) const { +int Schema::getIndexFromName(const std::string& parentType, const std::string& memberName) const { check_error(hasMember(parentType, memberName), memberName + " is not a member of " + parentType); @@ -430,8 +434,13 @@ const std::set& Schema::getAllObjectTypes() const { membershipRelation.find(parentType); // At this point we know if we do not have a hit, then try a parent - if(membershipRelation_it == membershipRelation.end() && hasParent(parentType)) - return getIndexFromName(getParent(parentType), memberName); + if(membershipRelation_it == membershipRelation.end()) { + if(hasParent(parentType)) + return getIndexFromName(getParent(parentType), memberName); + else + return -1; + } + // Alternately, we have to have a hit const NameValueVector& members = membershipRelation_it->second; diff --git a/src/PLASMA/PlanDatabase/base/Schema.hh b/src/PLASMA/PlanDatabase/base/Schema.hh index cb665609d..5849ecb12 100644 --- a/src/PLASMA/PlanDatabase/base/Schema.hh +++ b/src/PLASMA/PlanDatabase/base/Schema.hh @@ -247,7 +247,7 @@ class LabelStr; * @param type the type to search * @param memberName the name of the member */ - unsigned int getIndexFromName(const std::string& type, const std::string& memberName) const; + int getIndexFromName(const std::string& type, const std::string& memberName) const; /** * @brief Gets the name of a member from a types member list. diff --git a/src/PLASMA/PlanDatabase/component/DbClientTransactionPlayer.cc b/src/PLASMA/PlanDatabase/component/DbClientTransactionPlayer.cc index 9d018f2de..f854afef3 100644 --- a/src/PLASMA/PlanDatabase/component/DbClientTransactionPlayer.cc +++ b/src/PLASMA/PlanDatabase/component/DbClientTransactionPlayer.cc @@ -486,13 +486,14 @@ std::string DbClientTransactionPlayer::getObjectAndType(const SchemaId schema, bool rejectable, bool isFact) { + std::string sname(name ? name : ""); // The type may be qualified with an object name, in which case we should get the // object and specify it. We will also have to generate the appropriate type designation // by extracting the class from the object ObjectId object; std::string predicateType = getObjectAndType(getSchema(),m_client,type,object); - TokenId token = m_client->createToken(predicateType.c_str(),name,rejectable,isFact); + TokenId token = m_client->createToken(predicateType.c_str(),sname,rejectable,isFact); if (!object.isNoId()) { // We restrict the base domain permanently since the name is specifically mentioned on creation @@ -500,8 +501,7 @@ std::string DbClientTransactionPlayer::getObjectAndType(const SchemaId schema, } if (name != NULL) { - std::string std_name = name; - m_tokens[std_name] = token; + m_tokens[sname] = token; } else { name = "NO_NAME_DBCTP"; diff --git a/src/PLASMA/Resource/base/Resource.cc b/src/PLASMA/Resource/base/Resource.cc index 3eb68276f..3f8b8bac9 100644 --- a/src/PLASMA/Resource/base/Resource.cc +++ b/src/PLASMA/Resource/base/Resource.cc @@ -118,6 +118,8 @@ void Resource::init(const edouble initCapacityLb, const edouble initCapacityUb, checkRuntimeError(prop.isValid(), "Failed to get Resource propagator. Can't register profiles."); ProfilePropagator* profileProp = dynamic_cast(static_cast(prop)); + checkRuntimeError(profileProp != NULL, + "Failed to get Resource propagator. Can't register profiles."); //TODO: have the capacity and limit profiles extend the Profile class and get added //correctly // profileProp->addProfile(m_capacityProfile); diff --git a/src/PLASMA/Solvers/component/OpenConditionDecisionPoint.cc b/src/PLASMA/Solvers/component/OpenConditionDecisionPoint.cc index 53ad0fbef..858f5600e 100644 --- a/src/PLASMA/Solvers/component/OpenConditionDecisionPoint.cc +++ b/src/PLASMA/Solvers/component/OpenConditionDecisionPoint.cc @@ -491,7 +491,10 @@ void SupportToken::execute() if (slave->getFullTokenType() == m_token->getFullTokenType()) { // TODO: use ids if (effectCnt == m_effectIndex) { // TODO: eliminate the need for the dynamic cast below - TokenId slaveId = dynamic_cast(slave)->getId(); + Token* tok = dynamic_cast(slave); + checkError(tok != NULL, + "Failed to cast " << slave->toString() << " to a token."); + TokenId slaveId = tok->getId(); m_targetEffect = slaveId; m_dbClient->merge(m_targetEffect,m_token); break; diff --git a/src/PLASMA/TemporalNetwork/base/TemporalNetwork.cc b/src/PLASMA/TemporalNetwork/base/TemporalNetwork.cc index a219665de..4c19bf862 100644 --- a/src/PLASMA/TemporalNetwork/base/TemporalNetwork.cc +++ b/src/PLASMA/TemporalNetwork/base/TemporalNetwork.cc @@ -766,12 +766,10 @@ Void TemporalNetwork::incDijkstraForward() { check_error_variable(unsigned long BFbound = this->nodes.size()); while (true) { - Dnode* dnode = queue.popMinFromQueue(); - if (dnode == NULL) + Timepoint* node = dynamic_cast(queue.popMinFromQueue()); + if (node == NULL) return; - Timepoint* node = dynamic_cast(dnode); - for (int i=0; i< node->outCount; i++) { Dedge* edge = node->outArray[i]; Timepoint& next = dynamic_cast(edge->to); @@ -801,11 +799,10 @@ Void TemporalNetwork::incDijkstraBackward() { check_error_variable(unsigned long BFbound = this->nodes.size()); while (true) { - Dnode* dnode = queue.popMinFromQueue(); - if(dnode == NULL) - return; - Timepoint* node = dynamic_cast(dnode); + Timepoint* node = dynamic_cast(queue.popMinFromQueue()); + if(node == NULL) + return; for (int i=0; i< node->inCount; i++) { Dedge* edge = node->inArray[i]; @@ -839,10 +836,10 @@ Void TemporalNetwork::incDijkstraBackward() { check_error_variable(unsigned long BFbound = this->nodes.size()); while (true) { - Dnode* dnode = queue.popMinFromQueue(); - if (dnode == NULL) + Timepoint* node = dynamic_cast(queue.popMinFromQueue()); + if (node == NULL) return; - Timepoint* node = dynamic_cast(dnode); + for (int i=0; i< node->outCount; i++) { Dedge* edge = node->outArray[i]; Timepoint& next = dynamic_cast(edge->to); @@ -874,10 +871,9 @@ Void TemporalNetwork::incDijkstraBackward() { check_error_variable(unsigned long BFbound = this->nodes.size()); while (true) { - Dnode* dnode = queue.popMinFromQueue(); - if(dnode == NULL) + Timepoint* node = dynamic_cast(queue.popMinFromQueue()); + if(node == NULL) return; - Timepoint* node = dynamic_cast(dnode); for (int i=0; i< node->inCount; i++) { Dedge* edge = node->inArray[i]; Timepoint& next = dynamic_cast(edge->from); diff --git a/src/PLASMA/Utils/base/Entity.cc b/src/PLASMA/Utils/base/Entity.cc index d17d9b8e1..aab8e925d 100644 --- a/src/PLASMA/Utils/base/Entity.cc +++ b/src/PLASMA/Utils/base/Entity.cc @@ -54,7 +54,7 @@ class EntityInternals { std::map m_entitiesByKey; std::set m_discardedEntities; - bool m_purgeStatus, m_gcActive, m_gcRequired; + bool m_purgeStatus; int m_key; };