예제 #1
0
void PhysicsServerManager::register_server(const String &p_name, CreatePhysicsServerCallback p_creat_callback) {

	ERR_FAIL_COND(!p_creat_callback);
	ERR_FAIL_COND(find_server_id(p_name) != -1);
	physics_servers.push_back(ClassInfo(p_name, p_creat_callback));
	on_servers_changed();
}
예제 #2
0
파일: type.cpp 프로젝트: AojiaoZero/hhvm
  static folly::Optional<ClassInfo> commonAncestor(ClassInfo a,
                                                   ClassInfo b) {
    if (!isNormalClass(a.get()) || !isNormalClass(b.get())) return folly::none;
    if (auto result = a.get()->commonAncestor(b.get())) {
      return ClassInfo(result, ClassTag::Sub);
    }

    return folly::none;
  }
예제 #3
0
파일: class_conf.c 프로젝트: LuaDist/iup
int main(int argc, char* argv[])
{
  IupOpen(&argc, &argv);

  ClassInfo();

  IupMainLoop();

  IupClose();

  return EXIT_SUCCESS;
}
예제 #4
0
ErrorCode ComponentManager::AddService( CID cid, ISupports *service )
{
	TRACE_BEGIN( LOG_LVL_INFO );
	ClassInfo *info = jh_new ClassInfo( cid, service );
	
	LOG( "Adding cid %s, ISupports %p", cid.toString(), service );
	
	service->AddRef();
	
	mClasses.push_back( info );
	
	return kNoError;
}
// Add the given name/value pair to the current class info hash.
PyObject *qpycore_ClassInfo(const char *name, const char *value)
{
    PyFrameObject *frame = PyEval_GetFrame();

    // We need the frame we were called from, not the current one.
    if (frame)
        frame = frame->f_back;

    if (!frame)
    {
        PyErr_SetString(PyExc_RuntimeError, "no current frame");
        return 0;
    }

    class_info_hash.insert(frame,
            ClassInfo(QByteArray(name), QByteArray(value)));

    Py_INCREF(Py_None);
    return Py_None;
}
예제 #6
0
// ######################################################################
std::vector<Bayes::ClassInfo> Bayes::classifyRange(std::vector<double> &fv,
                                                   int &retCls, const bool sortit)
{

  std::vector<ClassInfo> classInfoRet;

  //the maximum posterior  (MAP alg):
  itsMaxProb  = -std::numeric_limits<double>::max();
  itsSumProb  = 0.0F;
  itsNormProb = 0.0F;
  int maxCls = -1;

  for(uint cls=0; cls<itsNumClasses; cls++)
  {
    //Find the probability that the fv belongs to this class
    double probVal = 0; //log(getClassProb(cls)); //the prior probility
    for (uint i=0; i<itsNumFeatures; i++) //get the posterior prob
    {
      if (itsMean[cls][i] > 0)  //only process if mean > 0
      {
        const double g = gauss(fv[i], itsMean[cls][i], itsStdevSq[cls][i]);
        probVal += log(g);
      }
    }

    itsSumProb += exp(probVal);
    if (probVal > itsMaxProb){ //we have a new max
      itsMaxProb = probVal;
      maxCls = cls;
    }
    classInfoRet.push_back(ClassInfo(cls, probVal, getStatSig(fv, cls)));
  }

  itsMaxProb  = exp(itsMaxProb);
  itsNormProb = itsMaxProb / itsSumProb;

  retCls = maxCls;
  if (sortit)
    std::sort(classInfoRet.begin(), classInfoRet.end(), lessClassInfo());
  return classInfoRet;
}
예제 #7
0
void ClassDB::_add_class2(const StringName &p_class, const StringName &p_inherits) {

	OBJTYPE_WLOCK;

	StringName name = p_class;

	ERR_FAIL_COND(classes.has(name));

	classes[name] = ClassInfo();
	ClassInfo &ti = classes[name];
	ti.name = name;
	ti.inherits = p_inherits;
	ti.api = current_api;

	if (ti.inherits) {

		ERR_FAIL_COND(!classes.has(ti.inherits)); //it MUST be registered.
		ti.inherits_ptr = &classes[ti.inherits];

	} else {
		ti.inherits_ptr = NULL;
	}
}
예제 #8
0
파일: Class.cpp 프로젝트: lcs2/carpg
// character class
#include "Pch.h"
#include "Core.h"
#include "Class.h"
#include "UnitData.h"

//-----------------------------------------------------------------------------
ClassInfo ClassInfo::classes[(int)Class::MAX] = {
	ClassInfo(Class::BARBARIAN, "barbarian", "base_warrior", "icon_barbarian.png", false, nullptr),
	ClassInfo(Class::BARD, "bard", "base_rogue", "icon_bard.png", false, nullptr),
	ClassInfo(Class::CLERIC, "cleric", "base_warrior", "icon_cleric.png", false, nullptr),
	ClassInfo(Class::DRUID, "druid", "base_hunter", "icon_druid.png", false, nullptr),
	ClassInfo(Class::HUNTER, "hunter", "base_hunter", "icon_hunter.png", true, "summon_wolf"),
	ClassInfo(Class::MAGE, "mage", "base_rogue", "icon_mage.png", false, nullptr),
	ClassInfo(Class::MONK, "monk", "base_rogue", "icon_monk.png", false, nullptr),
	ClassInfo(Class::PALADIN, "paladin", "base_warrior", "icon_paladin.png", false, nullptr),
	ClassInfo(Class::ROGUE, "rogue", "base_rogue", "icon_rogue.png", true, "dash"),
	ClassInfo(Class::WARRIOR, "warrior", "base_warrior", "icon_warrior.png", true, "bull_charge")
};

// START EQUIPMENT
//barbarian - axe2, light armor, vodka, healing potions
//bard - weapon for picked skill or short blade

//=================================================================================================
ClassInfo* ClassInfo::Find(const string& id)
{
	for(ClassInfo& c : ClassInfo::classes)
	{
		if(id == c.id)
			return &c;