Ejemplo n.º 1
0
void execenumsInNamespaces(){

   std::cout << "Creating empty Namespace\n";
   gInterpreter->ProcessLine("namespace myNamespace{};");
   checkEnum();

   // This avoids double injection in the interpreter of the enum definition
   // which is not swallowed by ROOT when modules are active - and rightfully so
   // as this is how C++ works.
   gInterpreter->ProcessLine("#define __mynamespace__");

   std::cout << "Loading library\n";
   gSystem->Load("libenumsInNamespaces_dictrflx");
   checkEnum();

   std::cout << "Adding enum in the interpreter\n";
   gInterpreter->ProcessLine("namespace myNamespace{enum B{kOne};};");
   checkEnum();

   // Now check that the enum read from protoclasses does not appear twice after being re-defined in the interpreter
   auto enList = TClass::GetClass("myNamespace2")->GetListOfEnums();
   gInterpreter->ProcessLine("namespace myNamespace2{enum C{kOne};}");
   enList = TClass::GetClass("myNamespace2")->GetListOfEnums();
   int nEnums =enList->GetSize();
   if (nEnums != 1 ){
     std::cerr << "One enum expected, but " << nEnums << " found!\n";
     enList->Dump();
   }
}
Ejemplo n.º 2
0
	int LuaEnum::lua_toString(lua_State* L){
		LuaEnum* itm = checkEnum(L, 1);
		std::string name = "Enum.";
		name += itm->Type;
		lua_pushstring(L, name.c_str());
		return 1;
	}
int readEnum(lua_State* luaSt, const MWEnumAssociation* options, const char* name)
{
    int rc;

    assert(name);
    lua_pushstring(luaSt, name);
    rc = checkEnum(luaSt, options, lua_gettop(luaSt));
    lua_pop(luaSt, 1);
    return rc;
}
Ejemplo n.º 4
0
	int LuaEnum::lua_index(lua_State* L){
		LuaEnum* con = checkEnum(L, 1);
		if(con != NULL){
			const char* name = luaL_checkstring(L, 2);
			//TODO: make this work
			LuaEnumItem* enm = con->EnumValues[std::string(name)];
			if(enm != NULL){
				return enm->wrap_lua(L);
			}
		}
		return 0;
	}
static int setCriterionT(lua_State* luaSt, void* v)
{
    *(criterion_t*) v = checkEnum(luaSt, criterionOptions, 3);
    return 0;
}