complex_assert::complex_assert(MODULE *module)
{
	if (oclass==NULL)
	{
		// register to receive notice for first top down. bottom up, and second top down synchronizations
		oclass = gl_register_class(module,"complex_assert",sizeof(complex_assert),PC_AUTOLOCK|PC_OBSERVER);
		if (oclass==NULL)
			throw "unable to register class complex_assert";
		else
			oclass->trl = TRL_PROVEN;

		if (gl_publish_variable(oclass,
			// TO DO:  publish your variables here
			PT_enumeration,"status",get_status_offset(),
				PT_KEYWORD,"ASSERT_TRUE",(enumeration)ASSERT_TRUE,
				PT_KEYWORD,"ASSERT_FALSE",(enumeration)ASSERT_FALSE,
				PT_KEYWORD,"ASSERT_NONE",(enumeration)ASSERT_NONE,
			PT_enumeration, "once", get_once_offset(),
				PT_KEYWORD,"ONCE_FALSE",(enumeration)ONCE_FALSE,
				PT_KEYWORD,"ONCE_TRUE",(enumeration)ONCE_TRUE,
				PT_KEYWORD,"ONCE_DONE",(enumeration)ONCE_DONE,
			PT_enumeration, "operation", get_operation_offset(),
				PT_KEYWORD,"FULL",(enumeration)FULL,
				PT_KEYWORD,"REAL",(enumeration)REAL,
				PT_KEYWORD,"IMAGINARY",(enumeration)IMAGINARY,
				PT_KEYWORD,"MAGNITUDE",(enumeration)MAGNITUDE,
				PT_KEYWORD,"ANGLE",(enumeration)ANGLE, // If using, please specify in radians
			PT_complex, "value", get_value_offset(),
			PT_double, "within", get_within_offset(),
			PT_char1024, "target", get_target_offset(),	
			NULL)<1){
				char msg[256];
				sprintf(msg, "unable to publish properties in %s",__FILE__);
				throw msg;
		}

		defaults = this;
		status = ASSERT_TRUE;
		within = 0.0;
		value = 0.0;
		once = ONCE_FALSE;
		once_value = 0;
		operation = FULL;
	}
}
Example #2
0
double_assert::double_assert(MODULE *module)
{
	if (oclass==NULL)
	{
		// register to receive notice for first top down. bottom up, and second top down synchronizations
		oclass = gl_register_class(module,"double_assert",sizeof(double_assert),PC_AUTOLOCK|PC_OBSERVER);
		if (oclass==NULL)
			throw "unable to register class double_assert";
		else
			oclass->trl = TRL_PROVEN;

		if (gl_publish_variable(oclass,
			// TO DO:  publish your variables here
			PT_enumeration,"status",get_status_offset(),PT_DESCRIPTION,"Conditions for the assert checks",
				PT_KEYWORD,"ASSERT_TRUE",(enumeration)ASSERT_TRUE,
				PT_KEYWORD,"ASSERT_FALSE",(enumeration)ASSERT_FALSE,
				PT_KEYWORD,"ASSERT_NONE",(enumeration)ASSERT_NONE,
			PT_enumeration, "once", get_once_offset(),PT_DESCRIPTION,"Conditions for a single assert check",
				PT_KEYWORD,"ONCE_FALSE",(enumeration)ONCE_FALSE,
				PT_KEYWORD,"ONCE_TRUE",(enumeration)ONCE_TRUE,
				PT_KEYWORD,"ONCE_DONE",(enumeration)ONCE_DONE,
			PT_enumeration, "within_mode", get_within_mode_offset(),PT_DESCRIPTION,"Method of applying tolerance",
				PT_KEYWORD,"WITHIN_VALUE",(enumeration)IN_ABS,
				PT_KEYWORD,"WITHIN_RATIO",(enumeration)IN_RATIO,
			PT_double, "value", get_value_offset(),PT_DESCRIPTION,"Value to assert",
			PT_double, "within", get_within_offset(),PT_DESCRIPTION,"Tolerance for a successful assert",
			PT_char1024, "target", get_target_offset(),PT_DESCRIPTION,"Property to perform the assert upon",
			NULL)<1){
				char msg[256];
				sprintf(msg, "unable to publish properties in %s",__FILE__);
				throw msg;
		}

		defaults = this;
		status = ASSERT_TRUE;
		within = 0.0;
		within_mode = IN_ABS;
		value = 0.0;
		once = ONCE_FALSE;
		once_value = 0;
	}
}