本文整理汇总了C++中LOG_DEBUG_F函数的典型用法代码示例。如果您正苦于以下问题:C++ LOG_DEBUG_F函数的具体用法?C++ LOG_DEBUG_F怎么用?C++ LOG_DEBUG_F使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LOG_DEBUG_F函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QueryInterfaceException
// todo: lift to HIVIntervention or helper function (repeated in HIVDelayedIntervention)
bool HIVSimpleDiagnostic::UpdateCascade()
{
if( AbortDueToCurrentCascadeState() )
{
return false ;
}
// is this the first time through? if so, update the cascade state.
if (firstUpdate)
{
IHIVCascadeOfCare *ihcc = nullptr;
if ( s_OK != parent->GetInterventionsContext()->QueryInterface(GET_IID(IHIVCascadeOfCare), (void **)&ihcc) )
{
throw QueryInterfaceException( __FILE__, __LINE__, __FUNCTION__,
"parent->GetInterventionsContext()",
"IHIVCascadeOfCare",
"IIndividualHumanInterventionsContext" );
}
LOG_DEBUG_F( "Setting Cascade State to %s for individual %d.\n", cascadeState.c_str(), parent->GetSuid().data );
ihcc->setCascadeState(cascadeState);
original_days_to_diagnosis = days_to_diagnosis;
}
return true ;
}
示例2: LOG_DEBUG_F
void FlowControllerImpl::UpdateDesiredFlow( const IdmDateTime& rCurrentTime, float dt )
{
LOG_DEBUG_F("%s()\n", __FUNCTION__);
// ----------------------------------------------------------
// --- Count the total number of people eligible for pairing
// ----------------------------------------------------------
float cumulative_base_flow = 0.0f;
for( int risk_group = 0; risk_group < RiskGroup::COUNT; risk_group ++)
{
auto& eligible_population = pair_formation_stats->GetEligible((RiskGroup::Enum)risk_group);
for (auto& entry : eligible_population)
{
for (float flow : entry.second)
{
cumulative_base_flow += flow;
}
}
if (LOG_LEVEL(INFO))
{
LOG_INFO_F( "%s: eligible population for %s risk group:\n", __FUNCTION__, RiskGroup::pairs::lookup_key(risk_group) );
for (auto& entry : eligible_population) {
cout << "{ " << entry.first << ", [ ";
for (int count : entry.second) {
cout << count << ' ';
}
cout << "] }" << endl;
}
}
}
// ---------------------------------------------------------------------
// --- Multiply the total number of people eligible times the base rate
// ---------------------------------------------------------------------
cumulative_base_flow *= parameters->FormationRate( rCurrentTime, dt );
if (cumulative_base_flow > 0.0f)
{
// -----------------------------------------------------------
// --- Determine the desired rate for each gender and age bin
// -----------------------------------------------------------
for (int sex = Gender::MALE; sex <= Gender::FEMALE; sex++)
{
auto& desired = desired_flow.at(sex); // important, use a reference here so we update desired_flow
auto& marginal = parameters->MarginalValues().at(sex); // use a reference here to avoid a copy
int bin_count = desired.size();
for (int bin_index = 0; bin_index < bin_count; bin_index++)
{
desired[bin_index] = 0.5f * cumulative_base_flow * marginal[bin_index];
}
}
}
else
{
memset(desired_flow[Gender::MALE].data(), 0, desired_flow[Gender::MALE].size() * sizeof(float));
memset(desired_flow[Gender::FEMALE].data(), 0, desired_flow[Gender::FEMALE].size() * sizeof(float));
}
}
示例3: LOG_DEBUG_F
bool
NodeLevelHealthTriggeredIV::Distribute(
INodeEventContext *pNodeEventContext,
IEventCoordinator2 *pEC
)
{
bool was_distributed = BaseNodeIntervention::Distribute(pNodeEventContext, pEC);
if (was_distributed)
{
LOG_DEBUG_F("Distributed Nodelevel health-triggered intervention to NODE: %d\n", pNodeEventContext->GetId().data);
// QI to register ourself as a NodeLevelHealthTriggeredIV observer
INodeTriggeredInterventionConsumer * pNTIC = nullptr;
if (s_OK != pNodeEventContext->QueryInterface(GET_IID(INodeTriggeredInterventionConsumer), (void**)&pNTIC))
{
throw QueryInterfaceException(__FILE__, __LINE__, __FUNCTION__, "pNodeEventContext", "INodeTriggeredInterventionConsumer", "INodeEventContext");
}
release_assert(pNTIC);
for (auto &trigger : m_trigger_conditions)
{
pNTIC->RegisterNodeEventObserver((IIndividualEventObserver*)this, trigger);
}
}
return was_distributed;
}
示例4: cost_per_unit
// BaseNodeIntervention
BaseNodeIntervention::BaseNodeIntervention()
: cost_per_unit(0.0f)
, expired(false)
{
initSimTypes( 1, "*" );
LOG_DEBUG_F("New intervention, cost_per_unit = %f\n", cost_per_unit);
}
示例5: duration_counter
ImportPressure::ImportPressure()
: duration_counter(0)
, num_imports(0)
{
LOG_DEBUG_F( "ctor\n" );
initSimTypes( 1, "GENERIC_SIM" );
}
示例6: LOG_DEBUG_F
void
DiagnosticTreatNeg::onPatientDefault()
{
LOG_DEBUG_F( "Individual %d got the test but defaulted, receiving Defaulters intervention without waiting for days_to_diagnosis (actually means days_to_intervention) \n", parent->GetSuid().data );
// Important: Use the instance method to obtain the intervention factory obj instead of static method to cross the DLL boundary
IGlobalContext *pGC = nullptr;
const IInterventionFactory* ifobj = nullptr;
if (s_OK == parent->QueryInterface(GET_IID(IGlobalContext), (void**)&pGC))
{
ifobj = pGC->GetInterventionFactory();
}
if (!ifobj)
{
throw NullPointerException( __FILE__, __LINE__, __FUNCTION__, "parent->GetInterventionFactoryObj()" );
}
if( !defaulters_event.IsUninitialized() )
{
if( defaulters_event != NO_TRIGGER_STR )
{
INodeTriggeredInterventionConsumer* broadcaster = nullptr;
if (s_OK != parent->GetEventContext()->GetNodeEventContext()->QueryInterface(GET_IID(INodeTriggeredInterventionConsumer), (void**)&broadcaster))
{
throw QueryInterfaceException( __FILE__, __LINE__, __FUNCTION__, "parent->GetEventContext()->GetNodeEventContext()", "INodeTriggeredInterventionConsumer", "INodeEventContext" );
}
broadcaster->TriggerNodeEventObserversByString( parent->GetEventContext(), defaulters_event );
}
}
else if( defaulters_config._json.Type() != ElementType::NULL_ELEMENT )
{
auto tmp_config = Configuration::CopyFromElement(defaulters_config._json);
// Distribute the defaulters intervention, right away (do not use the days_to_diagnosis
IDistributableIntervention *di = const_cast<IInterventionFactory*>(ifobj)->CreateIntervention( tmp_config );
delete tmp_config;
tmp_config = nullptr;
ICampaignCostObserver* pICCO;
// Now make sure cost of the test-positive intervention is reported back to node
if (s_OK == parent->GetEventContext()->GetNodeEventContext()->QueryInterface(GET_IID(ICampaignCostObserver), (void**)&pICCO) )
{
di->Distribute( parent->GetInterventionsContext(), pICCO );
pICCO->notifyCampaignEventOccurred( (IBaseIntervention*)di, (IBaseIntervention*)this, parent );
}
else
{
throw QueryInterfaceException( __FILE__, __LINE__, __FUNCTION__, "parent->GetEventContext()->GetNodeEventContext()", "ICampaignCostObserver", "INodeEventContext" );
}
}
else
{
throw GeneralConfigurationException( __FILE__, __LINE__, __FUNCTION__, "neither event or config defined" );
}
}
示例7: LOG_DEBUG_F
void SusceptibilityPy::Initialize(float _age, float _immmod, float _riskmod)
{
LOG_DEBUG_F( "Initializing Py immunity object for new individual: id=%lu, age=%f, immunity modifier=%f, risk modifier=%f\n", parent->GetSuid().data, _age, _immmod, _riskmod );
Susceptibility::Initialize(_age, _immmod, _riskmod);
// throws exception on error, no return type.
}
示例8: LOG_DEBUG_F
void IndividualHumanPy::AcquireNewInfection(StrainIdentity *infstrain, int incubation_period_override )
{
LOG_DEBUG_F("AcquireNewInfection: route %d\n", _routeOfInfection);
IndividualHuman::AcquireNewInfection( infstrain, incubation_period_override );
#ifdef ENABLE_PYTHON_FEVER
static auto pFunc = PythonSupportPtr->IdmPyInit( PythonSupport::SCRIPT_PYTHON_FEVER.c_str(), "acquire_infection" );
if( pFunc )
{
// pass individual id ONLY
static PyObject * vars = PyTuple_New(1);
PyObject* py_existing_id = PyLong_FromLong( GetSuid().data );
PyTuple_SetItem(vars, 0, py_existing_id );
//vars = Py_BuildValue( "l", GetSuid().data ); // BuildValue with 1 param seems to give errors
auto ret = PyObject_CallObject( pFunc, vars );
if( ret == nullptr )
{
PyErr_Print();
std::stringstream msg;
msg << "Embedded python code failed: PyObject_CallObject failed in call to 'acquire_infection'.";
throw Kernel::IllegalOperationException( __FILE__, __LINE__, __FUNCTION__, msg.str().c_str() );
}
}
#endif
}
示例9: LOG_DEBUG_F
void PairFormationStatsImpl::UpdateEligible( float age_in_days, int sex, RiskGroup::Enum risk_group, int delta )
{
LOG_DEBUG_F("%s( %f, %d, %s, %d )\n", __FUNCTION__, age_in_days, sex, RiskGroup::pairs::lookup_key(risk_group), delta);
int agebin_index = parameters->BinIndexForAgeAndSex(age_in_days, sex);
release_assert( (eligible_population.at(risk_group).at(sex)[agebin_index] + delta) >= 0 );
eligible_population.at(risk_group).at(sex)[agebin_index] += delta;
}
示例10: assert
array_list_t *snp_filter(array_list_t *input_records, array_list_t *failed, variant_stats_t **input_stats, char *filter_name, void *f_args) {
assert(input_records);
assert(failed);
array_list_t *passed = array_list_new(input_records->size + 1, 1, COLLECTION_MODE_ASYNCHRONIZED);
size_t filter_name_len = strlen(filter_name);
int include_snps = ((snp_filter_args*)f_args)->include_snps;
LOG_DEBUG_F("snp_filter (preserve SNPs = %d) over %zu records\n", include_snps, input_records->size);
vcf_record_t *record;
for (int i = 0; i < input_records->size; i++) {
record = input_records->items[i];
if (record->id_len == 1 && strncmp(".", record->id, 1) == 0) {
if (include_snps) {
annotate_failed_record(filter_name, filter_name_len, record);
array_list_insert(record, failed);
} else {
array_list_insert(record, passed);
}
} else {
if (include_snps) {
array_list_insert(record, passed);
} else {
annotate_failed_record(filter_name, filter_name_len, record);
array_list_insert(record, failed);
}
}
}
return passed;
}
示例11: switch
float SusceptibilityVector::BitingRiskAgeFactor(float _age)
{
float risk = 1.0f;
switch(SusceptibilityVectorConfig::age_dependent_biting_risk_type)
{
case AgeDependentBitingRisk::OFF:
// risk is independent by age
break;
case AgeDependentBitingRisk::LINEAR:
risk = LinearBitingFunction(_age);
break;
case AgeDependentBitingRisk::SURFACE_AREA_DEPENDENT:
risk = SurfaceAreaBitingFunction(_age);
break;
default:
throw BadEnumInSwitchStatementException( __FILE__, __LINE__, __FUNCTION__,
"age_dependent_biting_risk_type", SusceptibilityVectorConfig::age_dependent_biting_risk_type,
AgeDependentBitingRisk::pairs::lookup_key(SusceptibilityVectorConfig::age_dependent_biting_risk_type) );
}
LOG_DEBUG_F("Age-dependent biting-risk = %f for %0.2f-year-old individual.\n", risk, _age/DAYSPERYEAR);
return risk;
}
示例12: release_assert
bool CommunityHealthWorkerEventCoordinator::Distribute( IIndividualHumanEventContext* pIHEC )
{
release_assert( m_pInterventionIndividual );
IDistributableIntervention *di = m_pInterventionIndividual->Clone();
release_assert(di);
ICampaignCostObserver* p_icco = nullptr;
if (s_OK != pIHEC->GetNodeEventContext()->QueryInterface(GET_IID(ICampaignCostObserver), (void**)&p_icco))
{
throw QueryInterfaceException( __FILE__, __LINE__, __FUNCTION__, "pIHEC->GetNodeEventContext()", "ICampaignCostObserver", "INodeEventContext" );
}
di->AddRef();
bool distributed = di->Distribute( pIHEC->GetInterventionsContext(), p_icco );
if( distributed )
{
LOG_DEBUG_F("Distributed '%s' intervention to individual %d\n", m_InterventionName.c_str(), pIHEC->GetSuid().data );
}
di->Release();
return distributed;
}
示例13: IllegalOperationException
bool
ReferenceTrackingEventCoordinator::Configure(
const Configuration * inputJson
)
{
if( !JsonConfigurable::_dryrun &&
#ifdef ENABLE_TYPHOID
(GET_CONFIGURABLE( SimulationConfig )->sim_type != SimType::TYPHOID_SIM) &&
#endif
(GET_CONFIGURABLE( SimulationConfig )->sim_type != SimType::STI_SIM) &&
(GET_CONFIGURABLE( SimulationConfig )->sim_type != SimType::HIV_SIM) )
{
throw IllegalOperationException( __FILE__, __LINE__, __FUNCTION__, "ReferenceTrackingEventCoordinator can only be used in STI, HIV, and TYPHOID simulations." );
}
float update_period = DAYSPERYEAR;
initConfigComplexType("Time_Value_Map", &year2ValueMap, RTEC_Time_Value_Map_DESC_TEXT );
initConfigTypeMap( "Update_Period", &update_period, RTEC_Update_Period_DESC_TEXT, 1.0, 10*DAYSPERYEAR, DAYSPERYEAR );
initConfigTypeMap( "End_Year", &end_year, RTEC_End_Year_DESC_TEXT, MIN_YEAR, MAX_YEAR, MAX_YEAR );
auto ret = StandardInterventionDistributionEventCoordinator::Configure( inputJson );
num_repetitions = -1; // unlimited
if( JsonConfigurable::_dryrun == false )
{
float dt = GET_CONFIGURABLE(SimulationConfig)->Sim_Tstep;
tsteps_between_reps = update_period/dt; // this won't be precise, depending on math.
if( tsteps_between_reps <= 0.0 )
{
// don't let this be zero or it will only update one time
tsteps_between_reps = 1;
}
}
LOG_DEBUG_F( "ReferenceTrackingEventCoordinator configured with update_period = %f, end_year = %f, and tsteps_between_reps (derived) = %d.\n", update_period, end_year, tsteps_between_reps );
return ret;
}
示例14: associate_samples_and_positions
cp_hashtable* associate_samples_and_positions(vcf_file_t* file) {
LOG_DEBUG_F("** %zu sample names read\n", file->samples_names->size);
array_list_t *sample_names = file->samples_names;
cp_hashtable *sample_ids = cp_hashtable_create(sample_names->size * 2,
cp_hash_string,
(cp_compare_fn) strcasecmp
);
int *index;
char *name;
for (int i = 0; i < sample_names->size; i++) {
name = sample_names->items[i];
index = (int*) malloc (sizeof(int)); *index = i;
if (cp_hashtable_get(sample_ids, name)) {
LOG_FATAL_F("Sample %s appears more than once. File can not be analyzed.\n", name);
}
cp_hashtable_put(sample_ids, name, index);
}
// char **keys = (char**) cp_hashtable_get_keys(sample_ids);
// int num_keys = cp_hashtable_count(sample_ids);
// for (int i = 0; i < num_keys; i++) {
// printf("%s\t%d\n", keys[i], *((int*) cp_hashtable_get(sample_ids, keys[i])));
// }
return sample_ids;
}
示例15: if
const ProbabilityNumber
HIVInterventionsContainer::GetInfectivitySuppression()
const
{
// If not on art, 1.0f, else if ramping up, it's linear from 1.0 to 0.08, else if ramped up, 0.08f;
ProbabilityNumber ret = 1.0f;
float multiplier = InfectionHIVConfig::ART_viral_suppression_multiplier ;
if( ART_status == ARTStatus::ON_ART_BUT_NOT_VL_SUPPRESSED )
{
if( days_to_achieve_suppression == 0.0 )
{
ret = multiplier;
}
else
{
float time_since_starting_ART = days_to_achieve_suppression - full_suppression_timer ;
ret = 1.0f - ( ((1.0f - multiplier)/days_to_achieve_suppression) * (time_since_starting_ART) );
}
}
else if( ART_status == ARTStatus::ON_VL_SUPPRESSED )
{
ret = multiplier;
}
LOG_DEBUG_F( "Returning viral suppression factor of %f.\n", (float) ret );
return ret;
}