void DynamicsStepCostEstimator::loadParams(const ParameterSet& params)
{
  params.getParam("dynamic_step_cost_estimator/lower_step_limit", lower_step_limit);
  params.getParam("dynamic_step_cost_estimator/upper_step_limit", upper_step_limit);
  params.getParam("dynamic_step_cost_estimator/max_near_distance", max_near_distance_sq);
  max_near_distance_sq = max_near_distance_sq*max_near_distance_sq;
}
コード例 #2
0
ファイル: config.cpp プロジェクト: ovsm-dev/seiscomp3
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ParameterSet* Config::findParameterSet(const std::string& publicID) const {
	ParameterSet* object = ParameterSet::Cast(PublicObject::Find(publicID));
	if ( object != NULL && object->parent() == this )
		return object;
	
	return NULL;
}
コード例 #3
0
  bool singleRPAJastrowBuilder::put(xmlNodePtr cur, int addOrbital)
    {
    MyName="Jep";
    string rpafunc="RPA";
    OhmmsAttributeSet a;
    a.add(MyName,"name");
    a.add(rpafunc,"function");
    a.put(cur);

    ParameterSet params;
    RealType Rs(-1.0);
    RealType Kc(-1.0);
    params.add(Rs,"rs","double");
    params.add(Kc,"kc","double");

    params.put(cur);
        
    if(Rs<0) {
        Rs=tlen;
    }

    if(Kc<0){ 
      Kc = 1e-6 ;
    };


    if (rpafunc=="RPA"){ 
      myHandler= new LRRPAHandlerTemp<EPRPABreakup<RealType>,LPQHIBasis>(targetPtcl,Kc);
      app_log()<<"  using e-p RPA"<<endl;
    }
    else if (rpafunc=="dRPA") {
      myHandler= new LRRPAHandlerTemp<derivEPRPABreakup<RealType>,LPQHIBasis>(targetPtcl,Kc);
      app_log()<<"  using e-p derivRPA"<<endl;
    }
    myHandler->Breakup(targetPtcl,Rs);
    
//     app_log() << "  Maximum K shell " << myHandler->MaxKshell << endl;
//     app_log() << "  Number of k vectors " << myHandler->Fk.size() << endl;
    
    
    //Add short range part
    Rcut = myHandler->get_rc()-0.1;
    GridType* myGrid = new GridType;
    int npts=static_cast<int>(Rcut/0.01)+1;
    myGrid->set(0,Rcut,npts);

      //create the numerical functor
    nfunc = new FuncType;
    SRA = new ShortRangePartAdapter<RealType>(myHandler);
    SRA->setRmax(Rcut);
    nfunc->initialize(SRA, myGrid);
    J1s = new JneType (*sourcePtcl,targetPtcl);
    for(int ig=0; ig<ng; ig++) {
      J1s->addFunc(ig,nfunc);
    }

    app_log()<<" Only Short range part of E-I RPA is implemented"<<endl;
    if (addOrbital) targetPsi.addOrbital(J1s,MyName);
    return true;
  }
コード例 #4
0
ParameterSet* VectoredFeldmanCousins::getParameterSet( ParameterSet* inputSet, ResultParameterSet* inputResult )
{
	// Model 1 nuisence parameters are not changed
	if( nuisenceModel == 0 )
	{
		return new ParameterSet( *inputSet );
	}
	// Model 2 nuisence parameters are varied within 1 sigma of their true value
	else if( nuisenceModel == 1 )
	{
		ParameterSet* tempSet = new ParameterSet( *inputSet );
		vector<string> all_params = tempSet->GetAllNames();
		for( vector<string>::iterator param_i = all_params.begin(); param_i != all_params.end(); ++param_i )
		{
			PhysicsParameter* thisParameter = tempSet->GetPhysicsParameter( *param_i );
			ResultParameter* thisResult = inputResult->GetResultParameter( *param_i );
			if( thisParameter->GetType() != "Fixed" && !thisResult->GetScanStatus() )
			{
				TRandom3* rand_gen = RapidFitRandom::GetRandomFunction();
				double new_value = rand_gen->Gaus( thisResult->GetValue(), thisResult->GetError() );
				thisParameter->SetBlindedValue( new_value );
				thisParameter->SetStepSize( thisResult->GetError() );
			}
		}
		return tempSet;
	}
	else
	{
		cout << endl << "\t\tUNKNOWN NUICENCE MODEL, NOT DOING ANTYTHING!!!!" << endl << endl;
		nuisenceModel = 0;
		return this->getParameterSet( inputSet, inputResult );
	}
}
コード例 #5
0
ファイル: Test_main.cpp プロジェクト: shooting12/imtop
void TestCalculateScore_Dynamic_Rules()
{
	HRESULT hr;
	IplImage* img = cvLoadImage("TestLine.png",0);
	SimpleFingerDetectionResultSet DRset = LoaderAndWriter::LoadDetectionResultSetFromFile("DR_20.00_12.00_50.00_160.00.txt");

	MeasurementByRulesSet* measurementSet = new MeasurementByRulesSet();

	CalculateScore_Dynamic myCal;
	myCal.Init(img,20);
	myCal.SetDetectionResult(DRset);
	//myCal.DoCalculateScore(measurementSet);
	//hr = myCal.RuleGetDiffAmongDRandGT_Set(1,DRset,*measurementSet);
	//hr = myCal.RuleGetDistToTrace_Set(DRset,*measurementSet);
	//hr = myCal.RuleCheckContinuous_Set(181,264,2,DRset,*measurementSet);

	LoaderAndWriter::WriteMeasurementByRulesSetToFile(*measurementSet,"MeasurementByRulesSet.txt");
	measurementSet->SetStartAndEndFrameNo(181,264);
	float rate = measurementSet->GetGoodFrameRate();

	ParameterSet paramSet;
	paramSet.AddParameter("A",0);
	paramSet.AddParameter("B",1);
	paramSet.AddParameter("C",2);

	ParamSetAndMeasurementByRulesSet tmp;
	tmp.AddParamSetAndMeasurementSetPair(paramSet,*measurementSet);

	LoaderAndWriter::WriteParameterSetAndMeasurementByRulesSetToFile(tmp,"ParamSetAndMeasurementByRulesSet.txt");
}
コード例 #6
0
ファイル: Test_main.cpp プロジェクト: shooting12/imtop
void TestNewMethod()
{
	HRESULT hr;
	//IplImage* img = cvLoadImage("TestLine.png",0);
	IplImage *img = cvLoadImage("imgCenterLine_draw.png",0);
	SimpleFingerDetectionResultSet DRset = LoaderAndWriter::LoadDetectionResultSetFromFile("DR_17.16_10.42_13.42_93.41.txt"); // multi-result

	CalculateScore_Dynamic myCal;
	//myCal.Init(img,5);
	myCal.Init(img,10,1000);
	myCal.SetDetectionResult(DRset);

	MeasurementByTraceSet* msByTraceSet = new MeasurementByTraceSet();
	myCal.DoCalculateScore(msByTraceSet);

	LoaderAndWriter::WriteMeasurementByTraceSetToFile_new(*msByTraceSet,"newMeasurementByTraceSet.txt");

	ParameterSet paramSet;
	paramSet.AddParameter("A",0);
	paramSet.AddParameter("B",1);
	paramSet.AddParameter("C",2);

	ParamSetAndMeasurementByTraceSet tmp;
	tmp.AddParamSetAndMeasurementSetAndWeightPair(paramSet,*msByTraceSet,0.5);

	LoaderAndWriter::WriteParameterSetAndMeasurementByTraceSetToFile_new(tmp,"newParaAndMeasurementByTraceSet.txt",1);
	int x=0;
}
コード例 #7
0
HRESULT NextParametersGenerator::Init(const ParameterSet& paramSet, const ParameterSetRange& paramSetRange)
{
	if(paramSet.GetParamNum() != paramSetRange.GetParamNum())
		return E_FAIL;

	int nParamNum = paramSet.GetParamNum();

	m_currParamSet = paramSet;
	m_paramSetRange = paramSetRange;

	for(int x=0; x<nParamNum; x++)
	{
		m_currParamSet.SetParameterByIndex(x,m_paramSetRange.GetParameterLow(x));
	}

	m_nextParamSet = m_currParamSet;

	//--- calculate total iteration ---
	double low,high,step;
	int times = 1;
	int currTimes = 1;

	for(int x=0; x<m_paramSetRange.GetParamNum(); x++)
	{
		m_paramSetRange.GetParameterRange(x,&low,&high,&step);
		currTimes = (int)((high-low)/step) +1;
		times *= currTimes;
	}
	m_nTotalIteration = times;
	m_nCurrIteration = 0;
	
	return S_OK;
}
コード例 #8
0
ファイル: parameter.cpp プロジェクト: SeisComP3/seiscomp3
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool Parameter::detachFrom(PublicObject* object) {
	if ( object == NULL ) return false;

	// check all possible parents
	ParameterSet* parameterSet = ParameterSet::Cast(object);
	if ( parameterSet != NULL ) {
		// If the object has been added already to the parent locally
		// just remove it by pointer
		if ( object == parent() )
			return parameterSet->remove(this);
		// The object has not been added locally so it must be looked up
		else {
			Parameter* child = parameterSet->findParameter(publicID());
			if ( child != NULL )
				return parameterSet->remove(child);
			else {
				SEISCOMP_DEBUG("Parameter::detachFrom(ParameterSet): parameter has not been found");
				return false;
			}
		}
	}

	SEISCOMP_ERROR("Parameter::detachFrom(%s) -> wrong class type", object->className());
	return false;
}
コード例 #9
0
ファイル: config.cpp プロジェクト: ovsm-dev/seiscomp3
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool Config::updateChild(Object* child) {
	ParameterSet* parameterSetChild = ParameterSet::Cast(child);
	if ( parameterSetChild != NULL ) {
		ParameterSet* parameterSetElement
			= ParameterSet::Cast(PublicObject::Find(parameterSetChild->publicID()));
		if ( parameterSetElement && parameterSetElement->parent() == this ) {
			*parameterSetElement = *parameterSetChild;
			return true;
		}
		return false;
	}

	ConfigModule* configModuleChild = ConfigModule::Cast(child);
	if ( configModuleChild != NULL ) {
		ConfigModule* configModuleElement
			= ConfigModule::Cast(PublicObject::Find(configModuleChild->publicID()));
		if ( configModuleElement && configModuleElement->parent() == this ) {
			*configModuleElement = *configModuleChild;
			return true;
		}
		return false;
	}

	return false;
}
コード例 #10
0
/*--------------------------------------------------------------------------------*/
std::string AudioObjectParameters::ToString(bool pretty) const
{
  ParameterSet params;

  GetAll(params);

  return params.ToString(pretty);
}
コード例 #11
0
//..........................
//To take the current value of a parameter into the instance
void TripleFixedResModel::setParameters( ParameterSet & parameters )
{
	eventResolution = parameters.GetPhysicsParameter( eventResolutionName )->GetValue();
	resScale = parameters.GetPhysicsParameter( resScaleName )->GetValue();
	resScale2 = parameters.GetPhysicsParameter( resScale2Name )->GetValue();
	resScale3 = parameters.GetPhysicsParameter( resScale3Name )->GetValue();
	resFrac2 = parameters.GetPhysicsParameter( timeResFrac2Name )->GetValue();
	resFrac3 = parameters.GetPhysicsParameter( timeResFrac3Name )->GetValue();
	return;
}
コード例 #12
0
ファイル: ParameterSet.cpp プロジェクト: golobich/ALGatorC
void ParameterSet::add_parameters(ParameterSet &params, bool replace_existing)
{
    for (unsigned int i = 0; i < params.size(); i++)
    {
        EParameter *param = params.get_parameter(i);
        if (param != nullptr)
            add_parameter(*param, replace_existing);
        else
            LOG(WARNING) << __FILE__ << "(" << __LINE__ << ") : Null pointer";
    }
}
コード例 #13
0
ファイル: parameter.cpp プロジェクト: SeisComP3/seiscomp3
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool Parameter::attachTo(PublicObject* parent) {
	if ( parent == NULL ) return false;

	// check all possible parents
	ParameterSet* parameterSet = ParameterSet::Cast(parent);
	if ( parameterSet != NULL )
		return parameterSet->add(this);

	SEISCOMP_ERROR("Parameter::attachTo(%s) -> wrong class type", parent->className());
	return false;
}
コード例 #14
0
ファイル: ParameterSet.cpp プロジェクト: golobich/ALGatorC
ParameterSet::ParameterSet(ParameterSet &params)
{
    for (unsigned int i = 0; i<params.size(); i++)
    {
        EParameter *p = params.get_parameter(i);
        if (p != nullptr)
            add_parameter(*p, true);
        else
            LOG(WARNING) << __FILE__ << "(" << __LINE__ << ") : Null pointer";
        delete p;
    }
}
コード例 #15
0
 // ENG-2553. Connection shouldn't timeout.
 void testLargeReply() {
     (m_client)->createConnection("localhost");
     std::vector<Parameter> signature;
     signature.push_back(Parameter(WIRE_TYPE_STRING));
     signature.push_back(Parameter(WIRE_TYPE_STRING));
     signature.push_back(Parameter(WIRE_TYPE_STRING));
     Procedure proc("Insert", signature);
     ParameterSet *params = proc.params();
     params->addString("Hello").addString("World").addString("English");
     m_voltdb->filenameForNextResponse("mimicLargeReply");
     InvocationResponse response = (m_client)->invoke(proc);
     CPPUNIT_ASSERT(response.success());
 }
コード例 #16
0
 bool WalkerControlBase::put(xmlNodePtr cur) 
 {
   ParameterSet params;
   params.add(targetEnergyBound,"energyBound","double");
   params.add(targetSigma,"sigmaBound","double");
   params.add(MaxCopy,"maxCopy","int"); 
   bool success=params.put(cur);
   app_log() << "  WalkerControlBase parameters " << endl;
   //app_log() << "    energyBound = " << targetEnergyBound << endl;
   //app_log() << "    sigmaBound = " << targetSigma << endl;
   app_log() << "    maxCopy = " << MaxCopy << endl;
   return true;
 }
コード例 #17
0
ファイル: comment.cpp プロジェクト: marcelobianchi/seiscomp3
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool Comment::attachTo(PublicObject* parent) {
	if ( parent == NULL ) return false;

	// check all possible parents
	MomentTensor* momentTensor = MomentTensor::Cast(parent);
	if ( momentTensor != NULL )
		return momentTensor->add(this);
	FocalMechanism* focalMechanism = FocalMechanism::Cast(parent);
	if ( focalMechanism != NULL )
		return focalMechanism->add(this);
	Amplitude* amplitude = Amplitude::Cast(parent);
	if ( amplitude != NULL )
		return amplitude->add(this);
	Magnitude* magnitude = Magnitude::Cast(parent);
	if ( magnitude != NULL )
		return magnitude->add(this);
	StationMagnitude* stationMagnitude = StationMagnitude::Cast(parent);
	if ( stationMagnitude != NULL )
		return stationMagnitude->add(this);
	Pick* pick = Pick::Cast(parent);
	if ( pick != NULL )
		return pick->add(this);
	Event* event = Event::Cast(parent);
	if ( event != NULL )
		return event->add(this);
	Origin* origin = Origin::Cast(parent);
	if ( origin != NULL )
		return origin->add(this);
	Parameter* parameter = Parameter::Cast(parent);
	if ( parameter != NULL )
		return parameter->add(this);
	ParameterSet* parameterSet = ParameterSet::Cast(parent);
	if ( parameterSet != NULL )
		return parameterSet->add(this);
	Stream* stream = Stream::Cast(parent);
	if ( stream != NULL )
		return stream->add(this);
	SensorLocation* sensorLocation = SensorLocation::Cast(parent);
	if ( sensorLocation != NULL )
		return sensorLocation->add(this);
	Station* station = Station::Cast(parent);
	if ( station != NULL )
		return station->add(this);
	Network* network = Network::Cast(parent);
	if ( network != NULL )
		return network->add(this);

	SEISCOMP_ERROR("Comment::attachTo(%s) -> wrong class type", parent->className());
	return false;
}
コード例 #18
0
ファイル: main.C プロジェクト: patrickjmann/rshock1d_god5
LastDump::LastDump( TimeData& ptime )
{
  ParameterSet param;
  double epsdmp;
  param.Append( epsdmp, "epsdmp" );
  param.Append( interval_max, "dump.n" );
  ifstream s( "param.dat" );
  param.Get( s );
  s.close();
  
  time_max = epsdmp * ptime.CoordMax();   // time between dumps
  
  interval = 0; time = 0.0;
};
コード例 #19
0
ファイル: SHEGPotential.cpp プロジェクト: digideskio/qmcpack
bool SHEGPotential::put(xmlNodePtr cur)
{
  ParameterSet params;
  params.add(Rs,"rs","double");
  params.add(Zext,"Z","double");
  params.add(Zgauss,"Zgauss","double");
  params.add(Sgauss,"Sgauss","double");
  params.put(cur);
  if(Zext<Ntot)
  {
    XMLReport("Invalid background charge Z=" << Zext << "  Overwriting by " << Ntot);
    Zext=Ntot;
  }
  return true;
}
コード例 #20
0
 void QMCDriverFactory::putCommunicator(xmlNodePtr cur)
 {
   //BROKEN: myComm is ALWAYS initialized by the constructor
   if(myComm) return;
   ParameterSet params;
   int nparts=1;
   params.add(nparts,"groups","int");
   params.add(nparts,"twistAngles","int");
   params.put(cur);
   if(nparts>1) 
   {
     app_log() << "  Communiator groups = " << nparts << endl;
     myComm = new Communicate(*OHMMS::Controller,nparts);
   }
 }
コード例 #21
0
 void QMCDriverFactory::putCommunicator(xmlNodePtr cur)
 {
   //this should be done only once
   if(qmcComm) return;
   ParameterSet params;
   int nparts=1;
   params.add(nparts,"groups","int");
   params.add(nparts,"twistAngles","int");
   params.put(cur);
   if(nparts>1) 
   {
     app_log() << "  Communiator groups = " << nparts << endl;
     qmcComm = new Communicate(*OHMMS::Controller,nparts);
   }
 }
コード例 #22
0
void MapStepCostEstimator::loadParams(const ParameterSet& params)
{
  std::string filename;
  params.getParam("map_step_cost_estimator/file", filename);

  loadFromFile(filename);
}
コード例 #23
0
    void testBreakEventLoopViaCallback() {
        (m_client)->createConnection("localhost");
        std::vector<Parameter> signature;
        signature.push_back(Parameter(WIRE_TYPE_STRING));
        signature.push_back(Parameter(WIRE_TYPE_STRING));
        signature.push_back(Parameter(WIRE_TYPE_STRING));
        Procedure proc("Insert", signature);
        ParameterSet *params = proc.params();
        params->addString("Hello").addString("World").addString("English");
        m_voltdb->filenameForNextResponse("invocation_response_success.msg");

        BreakingSyncCallback *cb = new BreakingSyncCallback();
        boost::shared_ptr<ProcedureCallback> callback(cb);
        (m_client)->invoke(proc, callback);

        (m_client)->run();
    }
コード例 #24
0
 void testSyncInvoke() {
     m_client->createConnection("localhost");
     std::vector<Parameter> signature;
     signature.push_back(Parameter(WIRE_TYPE_STRING));
     signature.push_back(Parameter(WIRE_TYPE_STRING));
     signature.push_back(Parameter(WIRE_TYPE_STRING));
     Procedure proc("Insert", signature);
     ParameterSet *params = proc.params();
     params->addString("Hello").addString("World").addString("English");
     m_voltdb->filenameForNextResponse("invocation_response_success.msg");
     InvocationResponse response = (m_client)->invoke(proc);
     CPPUNIT_ASSERT(response.success());
     CPPUNIT_ASSERT(response.statusString() == "");
     CPPUNIT_ASSERT(response.appStatusCode() == -128);
     CPPUNIT_ASSERT(response.appStatusString() == "");
     CPPUNIT_ASSERT(response.results().size() == 0);
 }
コード例 #25
0
OSCL_EXPORT_REF bool AVCConfigurationBox::getSequenceParamSet(int32 index, uint16 &length, uint8* &paramSet)
{
    if ((uint32)index < _sequenceParameterSetVec->size())
    {
        ParameterSet *pSet = (*_sequenceParameterSetVec)[index];

        length = pSet->getParameterSetLength();
        paramSet = pSet->getParameterSet();

        return true;
    }
    else
    {
        length = 0;
        paramSet = NULL;
        return false;
    }
}
コード例 #26
0
bool ParameterOptimization::known(const ParameterSet &handle){
  for(vector<TestResult>::iterator it = current_results.begin();
      it != current_results.end(); ++it){
    const ParameterSet &current_handle = it->parameter_set;
    if(handle.equals(current_handle))
      return true;
  } 
  return false;
}
コード例 #27
0
bool ParameterSet::operator== ( const ParameterSet& input_rhs )
{
	bool names_match=true;
	vector<string> input_names_lhs = this->allNames;
	vector<string> input_names_rhs = input_rhs.allNames;
	//	Simple logical check for all wanted objects
	if( input_names_rhs.size() < input_names_lhs.size() ) return false;

	//	Check to see if wanted objects exist
	for( unsigned int i=0; i< input_names_lhs.size(); ++i )
	{
		//int this_index = StringProcessing::VectorContains( &input_names_rhs, &(input_names_lhs[i]) );
		input_rhs.GetPhysicsParameter( allInternalNames[i] );
		int this_index = allInternalNames[i].GetIndex();
		if( this_index == -1 )
		{
			names_match = false;
			break;
		}
	}

	if( !names_match )
	{
		return false;
	}
	else
	{
		//	Finally if needed compare the numerical values
		bool changed = false;
		for( unsigned int i=0; i< input_names_lhs.size(); ++i )
		{
			double lhs_val = this->GetPhysicsParameter( allInternalNames[i] )->GetValue();
			double rhs_val = input_rhs.GetPhysicsParameter( allForeignNames[i] )->GetValue();
			if( lhs_val != rhs_val )
			{
				changed = true;
				break;
			}
		}
		return !changed;
		//if( !changed ) return true;
		//else return false;
	}
}
コード例 #28
0
ファイル: Test_main.cpp プロジェクト: shooting12/imtop
void TestWriteParameterSetAndMeasurementByTraceSetToFile()
{
	HRESULT hr;
	//IplImage* img = cvLoadImage("TestLine.png",0);
	IplImage *img = cvLoadImage("GT_Line_thin.png",0);
	SimpleFingerDetectionResultSet DRset = LoaderAndWriter::LoadDetectionResultSetFromFile("DR_0.00_8.00_30.00_140.00.txt"); // multi-result
	//SimpleFingerDetectionResultSet DRset = LoaderAndWriter::LoadDetectionResultSetFromFile("DR_0.00_8.00_40.00_160.00.txt"); // one result
	//SimpleFingerDetectionResultSet DRset = LoaderAndWriter::LoadDetectionResultSetFromFile("DR_20.00_12.00_50.00_160.00.txt"); // no result

	MeasurementByTraceSet* msByTraceSet = new MeasurementByTraceSet();
	MeasurementByTrace ms;
	DataSequence seq;

	ParameterSet paramSet;
	paramSet.AddParameter("A",0);
	paramSet.AddParameter("B",1);
	paramSet.AddParameter("C",2);


	CalculateScore_Dynamic myCal;
	//myCal.Init(img,5);
	myCal.Init(img,15,720/2);
	myCal.SetDetectionResult(DRset);

	DataSequenceSet dataSeqSet;
	//myCal.GetSequenceStartAndEnd(dataSeqSet);
	//myCal.GetSequenceStartAndEnd(seq);
	//myCal.CalculateScoreOneFrame(64,DRset.GetSimpleDR_Ptr(64),seq);
	//myCal.CalculateScoreOneFrame(65,DRset.GetSimpleDR_Ptr(65),seq);
	//ms = myCal.CalculateScoreOneFrame(72,DRset.GetSimpleDR_Ptr(72),seq);
	//ms = myCal.CalculateScoreOneFrame(73,DRset.GetSimpleDR_Ptr(73),seq);
	myCal.DoCalculateScore(msByTraceSet);

	LoaderAndWriter::WriteMeasurementByTraceSetToFile(*msByTraceSet,"measurementByTrace_new.txt");

	ParamSetAndMeasurementByTraceSet tmp;
	tmp.AddParamSetAndMeasurementSetPair(paramSet,*msByTraceSet);
	LoaderAndWriter::WriteParameterSetAndMeasurementByTraceSetToFile(tmp,"ParaAndmeasurementByTrace_new.txt");

	int x=0;
}
コード例 #29
0
ファイル: config.cpp プロジェクト: ovsm-dev/seiscomp3
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool Config::add(ParameterSet* parameterSet) {
	if ( parameterSet == NULL )
		return false;

	// Element has already a parent
	if ( parameterSet->parent() != NULL ) {
		SEISCOMP_ERROR("Config::add(ParameterSet*) -> element has already a parent");
		return false;
	}

	if ( PublicObject::IsRegistrationEnabled() ) {
		ParameterSet* parameterSetCached = ParameterSet::Find(parameterSet->publicID());
		if ( parameterSetCached ) {
			if ( parameterSetCached->parent() ) {
				if ( parameterSetCached->parent() == this )
					SEISCOMP_ERROR("Config::add(ParameterSet*) -> element with same publicID has been added already");
				else
					SEISCOMP_ERROR("Config::add(ParameterSet*) -> element with same publicID has been added already to another object");
				return false;
			}
			else
				parameterSet = parameterSetCached;
		}
	}

	// Add the element
	_parameterSets.push_back(parameterSet);
	parameterSet->setParent(this);

	// Create the notifiers
	if ( Notifier::IsEnabled() ) {
		NotifierCreator nc(OP_ADD);
		parameterSet->accept(&nc);
	}

	// Notify registered observers
	childAdded(parameterSet);
	
	return true;
}
コード例 #30
0
    void testCallbackThrows() {
        class Listener : public StatusListener {
        public:
            bool reported;
           Listener() : reported(false) {}
            virtual bool uncaughtException(
                    std::exception exception,
                    boost::shared_ptr<voltdb::ProcedureCallback> callback,
                    InvocationResponse response) {
                reported = true;
                return true;
            }
            virtual bool connectionLost(std::string hostname, int32_t connectionsLeft) {
                CPPUNIT_ASSERT(false);
                return false;
            }
            virtual bool backpressure(bool hasBackpressure) {
                CPPUNIT_ASSERT(false);
                return false;
            }
        }  listener;
        (*m_dlistener)->m_listener = &listener;

        (m_client)->createConnection("localhost");
        std::vector<Parameter> signature;
        signature.push_back(Parameter(WIRE_TYPE_STRING));
        signature.push_back(Parameter(WIRE_TYPE_STRING));
        signature.push_back(Parameter(WIRE_TYPE_STRING));
        Procedure proc("Insert", signature);
        ParameterSet *params = proc.params();
        params->addString("Hello").addString("World").addString("English");
        m_voltdb->filenameForNextResponse("invocation_response_success.msg");

        ThrowingCallback *cb = new ThrowingCallback();
        boost::shared_ptr<ProcedureCallback> callback(cb);
        (m_client)->invoke(proc, callback);

        (m_client)->run();
    }