コード例 #1
0
ファイル: Online.cpp プロジェクト: tempbottle/SSVOpenHexagon
		void initializeValidators(HGAssets& mAssets)
		{
			HG_LO_VERBOSE("hg::Online::initializeValidators") << "Initializing validators...\n";

			for(const auto& p : mAssets.getLevelDatas())
			{
				HG_LO_VERBOSE("hg::Online::initializeValidators") << "Adding (" << p.first << ") validator\n";

				const auto& l(p.second);
				const auto& validator(getValidator(l->packPath, l->id, l->getRootString(), mAssets.getStyleData(l->styleId).getRootPath(), l->luaScriptPath));
				validators.addValidator(p.first, validator);

				HG_LO_VERBOSE("hg::Online::initializeValidators") << "Added (" << p.first << "): " << validator << "\n";
			}

			HG_LO_VERBOSE("hg::Online::initializeValidators") << "Finished initializing validators...\n";
		}
コード例 #2
0
int main( int argc, char ** argv )
{
	try
	{
		XMLPlatformUtils::Initialize();
	}
	catch( const XMLException& e )
	{
		cerr<< "Error during Xerces-c Initialization\n"
			<< "  Exception message:"
			<< DOMString(e.getMessage()) << endl;
		return 1;
	}

	if ( false == validateArguments(argc, argv))
	{
		usage("EXE-NAME: ");
		//exit (99);
	}

	EppParser *parser = new EppParser();

	EppXmlValidator* validator = getValidator();
	
	if (1 == argc)
	{
		validator->loadXSD(getenv("PWD"));
	}
	else if ((2 == argc) && (0 == strcmp(argv[1], ".")))
	{
		validator->loadXSD(getenv("PWD"));
	}
	else
	{
		validator->loadXSD(argv[1]);
	}


	runEppTestFee(*parser);

	delete parser;

	delete validator;
	XMLPlatformUtils::Terminate();
}
コード例 #3
0
void doValidate(XS orig, XS again, const char* methodName)
{
	std::cout<<methodName<<"::"<<endl;
	if( XMLON )
	{
		std::cout<<orig;
	}
	
	if (orig.equals(again))
	{
		std::cout<<endl<<"Result of toXML and fromXML matches"<<endl;
	}
	else
	{
		std::cout<<endl<<"*******ERROR****** Result of toXML and fromXML does NOT match"<<endl;
	}
	makeValidate(orig, *getValidator());
	//makeValidate(again, getValidator());

}
コード例 #4
0
ファイル: State.cpp プロジェクト: AndrewColes/VAL
void State::setNew(const effect_lists * is)
{
	logState.clear();
	feValue.clear();
	changedPNEs.clear();
	
	for(list<simple_effect*>::const_iterator i = is->add_effects.begin();
		i != is->add_effects.end();++i)
	{
		logState[vld->pf.buildLiteral(*i)] = true;
	};

	for(pc_list<assignment*>::const_iterator i1 = is->assign_effects.begin();
		i1 != is->assign_effects.end();++i1)
	{
		const FuncExp * fe = vld->fef.buildFuncExp((*i1)->getFTerm());
// DPL 2/2/06: Need to remember which PNEs changed in order to trigger
// processes properly in the initial state.
		changedPNEs.insert(fe);
		FEScalar feNewValue = dynamic_cast<const num_expression *>((*i1)->getExpr())->double_value();

		feValue[fe]	= feNewValue;

		//setup initial value for LaTeX graph
		if(LaTeX)
		{
			FEGraph * feg = getValidator()->getGraph(fe);

			//setup initial value if nec
			if(feg->initialTime == -1)
			{
					feg->initialTime = time;
					feg->initialValue = feNewValue;
			};
		};

	};
};
コード例 #5
0
ファイル: State.cpp プロジェクト: AndrewColes/VAL
void 
State::update(const FuncExp * fe,assign_op aop,FEScalar value)
{
	bool setInitialValue = false;
	FEGraph * feg = 0;
	
	if(LaTeX)
	{
		feg = getValidator()->getGraph(fe);
		
		//setup initial value if nec
		if(feg->initialTime == -1)
		{
			map<const FuncExp*,FEScalar>::const_iterator i = feValue.find(fe);

			
			if(i != feValue.end())
			{
				feg->initialTime = 0;
				feg->initialValue = fe->evaluate(this);
			}
			else
			{
				feg->initialTime = time;
				setInitialValue = true;
					
			};
			
			
		};
		
		
	};


	
	if(Verbose && !LaTeX) *report << "Updating " << *fe << " (" << feValue[fe] << ") by " << value << " ";

	FEScalar feValueInt = feValue[fe];

	switch(aop)
	{
		case E_ASSIGN:
			if(LaTeX)
			{
				*report << " \\> \\assignment{"<<*fe<<"}{"<<feValue[fe]<<"}{"<<value<<"}\\\\\n";
			}
			else if(Verbose) cout << "assignment\n";
			feValue[fe] = value;
			break;
		case E_ASSIGN_CTS:
			if(LaTeX)
			{
				*report << " \\> \\assignmentcts{"<<*fe<<"}{"<<feValue[fe]<<"}{"<<value<<"}\\\\\n";
			}
			else if(Verbose) cout << "assignment\n";
			feValue[fe] = value;
			return;
		case E_INCREASE:
			if(LaTeX)
			{
				*report << " \\> \\increase{"<<*fe<<"}{"<<feValue[fe]<<"}{"<<value<<"}\\\\\n";
			}
			else if(Verbose) cout << "increase\n";
			feValue[fe] += value;
			break;
		case E_DECREASE:
			if(LaTeX)
			{
				*report << " \\> \\decrease{"<<*fe<<"}{"<<feValue[fe]<<"}{"<<value<<"}\\\\\n";
			}
			else if(Verbose) cout << "decrease\n";
			feValue[fe] -= value;
			break;
		case E_SCALE_UP:
			if(LaTeX)
			{
				*report << " \\> \\scaleup{"<<*fe<<"}{"<<feValue[fe]<<"}{"<<value<<"}\\\\\n";
			}
			else if(Verbose) cout << "scale up\n";
			feValue[fe] *= value;
			break;
		case E_SCALE_DOWN:
			if(LaTeX)
			{
				*report << " \\> \\scaledown{"<<*fe<<"}{"<<feValue[fe]<<"}{"<<value<<"}\\\\\n";
			}
			else if(Verbose) cout << "scale down\n";
			feValue[fe] /= value;
			break;
		default:
			return;
	};

	//handle discontinuities in graphs
	if(LaTeX)
	{
		if(setInitialValue)
		{
			feValueInt = feValue[fe];
			feg->initialValue = feValueInt;
		};
		

		if( (feValueInt != feValue[fe]) || setInitialValue )
		{          
			//check value is already defined, may be communitive updates at the same time
			map<double,pair<double,double> >::iterator j = feg->discons.find(time);

			if(j == feg->discons.end())
			{
				feg->discons[time] = make_pair(feValueInt,feValue[fe]);
				feg->happenings.insert(time);
			}
			else
			{
				j->second.second = feValue[fe];
			};
			
		};

	

		
		
	};

	return;
	
};