Example #1
0
 static bool getStaticMethodInfo(JniMethodInfo &methodinfo, const char *methodName, const char *paramCode)
 {
     jmethodID methodID = 0;
     JNIEnv *pEnv = 0;
     bool bRet = false;
     
     do 
     {
         pEnv = getJNIEnv();
         if (! pEnv)
         {
             break;
         }
         
         jclass classID = getClassID(pEnv);
         
         methodID = pEnv->GetStaticMethodID(classID, methodName, paramCode);
         if (! methodID)
         {
             LOGD("Failed to find static method id of %s", methodName);
             break;
         }
         
         methodinfo.classID = classID;
         methodinfo.env = pEnv;
         methodinfo.methodID = methodID;
         
         bRet = true;
     } while (0);
     
     return bRet;
 }
void DeviceGraphicsDX11Geometry::archiveRead (Archive *archive)
{

    archive->pushDomain (getClassID ());
    
	BaseClass::archiveRead(archive);

	// New style geometry
	archive->pushDomain ("Streams");		
	*archive << ARCHIVE_DATA(_num_faces, DATA_PERSISTENT);
	*archive << ARCHIVE_DATA(_num_vertices, DATA_PERSISTENT);
	
	archive->addPostProcess(ARCHIVE_PROCESS_POINTERS_REFERENCED(archive,_index_stream));
	archive->addPostProcess(ARCHIVE_PROCESS_POINTERS_REFERENCED(archive,_color_stream));
	archive->addPostProcess(ARCHIVE_PROCESS_POINTERS_REFERENCED(archive,_vertex_stream));
	archive->addPostProcess(ARCHIVE_PROCESS_POINTERS_REFERENCED(archive,_normal_stream));
	archive->addPostProcess(ARCHIVE_PROCESS_POINTERS_REFERENCED(archive,_weights_strength_stream));
	archive->addPostProcess(ARCHIVE_PROCESS_POINTERS_REFERENCED(archive,_weights_index_stream));
	archive->addPostProcess(ARCHIVE_PROCESS_POINTERS_REFERENCED(archive,_texcoord_stream[0]));
	archive->addPostProcess(ARCHIVE_PROCESS_POINTERS_REFERENCED(archive,_texcoord_stream[1]));
	archive->addPostProcess(ARCHIVE_PROCESS_POINTERS_REFERENCED(archive,_texcoord_stream[2]));
	archive->addPostProcess(ARCHIVE_PROCESS_POINTERS_REFERENCED(archive,_texcoord_stream[3]));
	archive->addPostProcess(ARCHIVE_PROCESS_POINTERS_REFERENCED(archive,_texcoord_stream[4]));
	archive->addPostProcess(ARCHIVE_PROCESS_POINTERS_REFERENCED(archive,_texcoord_stream[5]));
	archive->addPostProcess(ARCHIVE_PROCESS_POINTERS_REFERENCED(archive,_texcoord_stream[6]));
	archive->addPostProcess(ARCHIVE_PROCESS_POINTERS_REFERENCED(archive,_texcoord_stream[7]));

	archive->popDomain ();
    archive->popDomain ();

}
Example #3
0
void ComponentGUIScroller::archive_write (Archive *archive)
{
    ComponentBase::archive_write(archive);

    archive->push_domain (getClassID ());
	
	*archive << ARCHIVE_PLUG(_material, DATA_PERSISTENT | DATA_SETTABLE);
    *archive << ARCHIVE_PLUG(_delete_material, DATA_PERSISTENT | DATA_SETTABLE);

	*archive << ARCHIVE_DATA(_scroll_horz, DATA_PERSISTENT | DATA_SETTABLE);
	*archive << ARCHIVE_DATA(_scroll_vert, DATA_PERSISTENT | DATA_SETTABLE);

	*archive << ARCHIVE_DATA(_auto_center_horz, DATA_PERSISTENT | DATA_SETTABLE);
	*archive << ARCHIVE_DATA(_auto_center_vert, DATA_PERSISTENT | DATA_SETTABLE);

    *archive << ARCHIVE_DATA(_pad_horz, DATA_PERSISTENT | DATA_SETTABLE);
    *archive << ARCHIVE_DATA(_pad_vert, DATA_PERSISTENT | DATA_SETTABLE);

    *archive << ARCHIVE_DATA(_can_rearrage_items, DATA_PERSISTENT | DATA_SETTABLE);
    *archive << ARCHIVE_DATA(_can_remove_items, DATA_PERSISTENT | DATA_SETTABLE);

	*archive << ARCHIVE_DATA(_velocity_decay, DATA_PERSISTENT | DATA_SETTABLE);

    archive->pop_domain ();
}
Example #4
0
bool Kawaz::OUYA::OuyaController::getMethodInfo(JniMethodInfo &methodInfo,
        const char *className, const char *methodName, const char *paramCode) {
    jmethodID methodID = 0;
    JNIEnv *pEnv = 0;
    bool bRet = false;

    do {
        pEnv = getJNIEnv();
        if (!pEnv) {
            break;
        }

        jclass classID = getClassID(pEnv, className);

        methodID = pEnv->GetMethodID(classID, methodName, paramCode);
        if (!methodID) {
            CCLOG("Failed to find method id of %s", methodName);
            break;
        }

        methodInfo.classID = classID;
        methodInfo.env = pEnv;
        methodInfo.methodID = methodID;

        bRet = true;
    } while (0);

    return bRet;
}
void ComponentPhysicsSetVelocity::archive_write (Archive *archive)
{
    ComponentBase::archive_write(archive);

    archive->push_domain (getClassID ());
    archive->pop_domain ();
}
Example #6
0
void ComponentDrawFlare::archive_write (Archive *archive)
{
    ComponentBase::archive_write(archive);

    archive->push_domain (getClassID ());
	
	*archive << ARCHIVE_PLUG(_alpha, DATA_PERSISTENT | DATA_SETTABLE);

	*archive << ARCHIVE_DATA_ACCESSORS("Material0", ComponentDrawFlare::getMaterial0, ComponentDrawFlare::setMaterial0, DATA_PERSISTENT | DATA_SETTABLE);
	*archive << ARCHIVE_DATA_NAMED("Size0",_size[0], DATA_PERSISTENT | DATA_SETTABLE);
	*archive << ARCHIVE_DATA_NAMED("Pos0",_pos[0], DATA_PERSISTENT | DATA_SETTABLE);

	*archive << ARCHIVE_DATA_ACCESSORS("Material1", ComponentDrawFlare::getMaterial1, ComponentDrawFlare::setMaterial1, DATA_PERSISTENT | DATA_SETTABLE);
	*archive << ARCHIVE_DATA_NAMED("Size1",_size[1], DATA_PERSISTENT | DATA_SETTABLE);
	*archive << ARCHIVE_DATA_NAMED("Pos1",_pos[1], DATA_PERSISTENT | DATA_SETTABLE);

	*archive << ARCHIVE_DATA_ACCESSORS("Material2", ComponentDrawFlare::getMaterial2, ComponentDrawFlare::setMaterial2, DATA_PERSISTENT | DATA_SETTABLE);
	*archive << ARCHIVE_DATA_NAMED("Size2",_size[2], DATA_PERSISTENT | DATA_SETTABLE);
	*archive << ARCHIVE_DATA_NAMED("Pos2",_pos[2], DATA_PERSISTENT | DATA_SETTABLE);

	*archive << ARCHIVE_DATA_ACCESSORS("Material3", ComponentDrawFlare::getMaterial3, ComponentDrawFlare::setMaterial3, DATA_PERSISTENT | DATA_SETTABLE);
	*archive << ARCHIVE_DATA_NAMED("Size3",_size[3], DATA_PERSISTENT | DATA_SETTABLE);
	*archive << ARCHIVE_DATA_NAMED("Pos3",_pos[3], DATA_PERSISTENT | DATA_SETTABLE);

	*archive << ARCHIVE_DATA_ACCESSORS("Material4", ComponentDrawFlare::getMaterial4, ComponentDrawFlare::setMaterial4, DATA_PERSISTENT | DATA_SETTABLE);
	*archive << ARCHIVE_DATA_NAMED("Size4",_size[4], DATA_PERSISTENT | DATA_SETTABLE);
	*archive << ARCHIVE_DATA_NAMED("Pos4",_pos[4], DATA_PERSISTENT | DATA_SETTABLE);

	*archive << ARCHIVE_DATA_ACCESSORS("Material5", ComponentDrawFlare::getMaterial5, ComponentDrawFlare::setMaterial5, DATA_PERSISTENT | DATA_SETTABLE);
	*archive << ARCHIVE_DATA_NAMED("Size5",_size[5], DATA_PERSISTENT | DATA_SETTABLE);
	*archive << ARCHIVE_DATA_NAMED("Pos5",_pos[5], DATA_PERSISTENT | DATA_SETTABLE);	

    archive->pop_domain ();
}
Example #7
0
bool ccObject::toFile(QFile& out) const
{
	assert(out.isOpen() && (out.openMode() & QIODevice::WriteOnly));

	//class ID (dataVersion>=20)
	uint32_t classID = getClassID();
	if (out.write((const char*)&classID,4)<0)
		return WriteError();

	//unique ID (dataVersion>=20)
	//DGM: this ID will be usefull to recreate dynamic links between entities!
	uint32_t uniqueID = (uint32_t)m_uniqueID;
	if (out.write((const char*)&uniqueID,4)<0)
		return WriteError();

	//name (dataVersion>=20)
	if (out.write(m_name,256)<0)
		return WriteError();

	//flags (dataVersion>=20)
	uint32_t flags = (uint32_t)m_flags;
	if (out.write((const char*)&flags,4)<0)
		return WriteError();

	return true;
}
Example #8
0
u32 JdwpWalker::getMethodID(const QString& cls_name, const QString& name, const QString& signature) {
    u64 cls_id = getClassID(cls_name);
    u32 ret = 0;
    if (cls_id != 0) {
        ret = getMethodID(cls_id, name, signature);
    }
    return ret;
}
Example #9
0
void ComponentDrawCamera::archive_write (Archive *archive)
{
    ComponentBase::archive_write(archive);

    archive->push_domain (getClassID ());
	*archive << ARCHIVE_DATA_ACCESSORS("Color", ComponentDrawCamera::getColor, ComponentDrawCamera::setColor, DATA_PERSISTENT | DATA_SETTABLE);
    archive->pop_domain ();
}
Example #10
0
void ScriptingCameraTexture::archiveWrite (Archive *archive)
{
    ScriptingBase::archiveWrite(archive);

    archive->pushDomain (getClassID ());
    
    archive->popDomain ();
}
Example #11
0
void mexFunction( int nlhs, mxArray *plhs[],
                  int nrhs, const mxArray *prhs[])
{
//  srand(0xffffff);
      
  //options struct
  HkmOptions opt; 
  
  //get input class
  mxClassID classID = getClassID(dataIn);

  //get the inputs
  if (nrhs<1)
    mexErrMsgTxt("At least one input is required");  
  if (nrhs>1) opt.niters = (int) *(mxGetPr(nitersIn));
  if (nrhs>2) opt.nlevels = (int) *(mxGetPr(nlevelsIn));
  if (nrhs>3) opt.nbranches = (int) *(mxGetPr(nbranchesIn));
  if (nrhs>4) opt.dist = getDistanceType(distIn);
  if (nrhs>5) opt.ntrees = (int) *(mxGetPr(ntreesIn));
  if (nrhs>6) opt.nchecks = (int) *(mxGetPr(nchecksIn));
  if (nrhs>7) opt.usekdt = (bool) *(mxGetPr(usekdtIn));
  
  if (nrhs>8) opt.kdtopt.ntrees = (int) *(mxGetPr(nkdtreesIn));
  if (nrhs>9) opt.kdtopt.varrange= (float) *(mxGetPr(varrangeIn));
  if (nrhs>10) opt.kdtopt.meanrange = (float) *(mxGetPr(meanrangeIn));
  if (nrhs>11) opt.kdtopt.cycle = (char) *(mxGetPr(cycleIn));
  if (nrhs>12) opt.kdtopt.maxbins = (int) *(mxGetPr(maxbinsIn));
  if (nrhs>13) opt.kdtopt.sample = (int) *(mxGetPr(sampleIn));  

  //set distance
  opt.kdtopt.dist = opt.dist;

//  //return output
//  mxArray* ret;
  
  //fill with the data
#define __CASE(CLASS)                                                     \
  {                                                                       \
    /*get the data*/                                                      \
    Data<TYPEOF_##CLASS> data;                                            \
  	/*allocate the kdforest*/                                             \
    Hkms<TYPEOF_##CLASS>* hkm = new Hkms<TYPEOF_##CLASS>(opt);            \
    /*set data*/                                                          \
    fillData(data, dataIn, false);                                        \
    /*create*/                                                            \
    hkm->create(data);                                                    \
    /*clear data*/                                                        \
    data.clear();                                                         \
    /*put output*/                                                        \
    hkmOut = exportMatlabPointer(*hkm);                                   \
  }

  __SWITCH(classID, __CASE)
    
  
//  hkmOut = ret;
//  cout << "here" << endl;
}
Example #12
0
bool ccObject::toFile(QFile& out) const
{
	assert(out.isOpen() && (out.openMode() & QIODevice::WriteOnly));

	//class ID (dataVersion>=20)
	//DGM: on 64 bits since version 34
	uint64_t classID = static_cast<uint64_t>(getClassID());
	if (out.write((const char*)&classID,8) < 0)
		return WriteError();

	//unique ID (dataVersion>=20)
	//DGM: this ID will be useful to recreate dynamic links between entities!
	uint32_t uniqueID = (uint32_t)m_uniqueID;
	if (out.write((const char*)&uniqueID,4) < 0)
		return WriteError();

	//name (dataVersion>=22)
	{
		QDataStream outStream(&out);
		outStream << m_name;
	}

	//flags (dataVersion>=20)
	uint32_t objFlags = (uint32_t)m_flags;
	if (out.write((const char*)&objFlags,4) < 0)
		return WriteError();

	//meta data (dataVersion>=30)
	{
		//check for valid pieces of meta-data
		//DGM: some pieces of meta-data can't be properly streamed (the ones relying on 'Q_DECLARE_METATYPE' calls typically)
		uint32_t validMetaDataCount = 0;
		for (QVariantMap::const_iterator it = m_metaData.begin(); it != m_metaData.end(); ++it)
		{
			if (!it.key().contains(".nosave"))
			{
				++validMetaDataCount;
			}
		}

		//count
		if (out.write((const char*)&validMetaDataCount, 4) < 0)
			return WriteError();

		//"key + value" pairs
		QDataStream outStream(&out);
		for (QVariantMap::const_iterator it = m_metaData.begin(); it != m_metaData.end(); ++it)
		{
			if (!it.key().contains(".nosave"))
			{
				outStream << it.key();
				outStream << it.value();
			}
		}
	}

	return true;
}
void mexFunction( int nlhs, mxArray *plhs[],
                  int nrhs, const mxArray *prhs[])
{
  srand(0xffffff);
      
  //options struct
  KdtOptions opt;
  
  //get input class
  mxClassID classID = getClassID(dataIn);

  //get the inputs
  if (nrhs<1)
    mexErrMsgTxt("At least one input is required");  
  if (nrhs>1) opt.ntrees = (int) *(mxGetPr(ntreesIn));
  if (nrhs>2) opt.varrange= (float) *(mxGetPr(varrangeIn));
  if (nrhs>3) opt.meanrange = (float) *(mxGetPr(meanrangeIn));
  if (nrhs>4) opt.maxdepth = (int) *(mxGetPr(maxdepthIn));
  if (nrhs>5) opt.minvar = (float) *(mxGetPr(minvarIn));
  if (nrhs>6) opt.cycle = (char) *(mxGetPr(cycleIn));
  if (nrhs>7) opt.dist = getDistanceType(distIn); 
  if (nrhs>8) opt.maxbins = (int) *(mxGetPr(maxbinsIn));
  if (nrhs>9) opt.sample = (int) *(mxGetPr(sampleIn));  
  if (nrhs>10) opt.bitsperdim = (int) *(mxGetPr(bitsperdimIn));

//   mexPrintf("depth = %d\n", opt.maxdepth);
//   mexPrintf("bitsperdim = %d\n", opt.bitsperdim);
//  mexPrintf("n inputs = %d\n", nrhs);
//  mexPrintf("sample = %f\n", opt.sample);
//  plhs[0] = mxCreateDoubleMatrix(1, 1, mxREAL);
//  return;
  

  //allocate the kdforest
  Kdf* kdf = new Kdf(opt);
  
  //fill with the data
#define __CASE(CLASS)                                                     \
  {                                                                       \
    /*get the data*/                                                      \
    Data<TYPEOF_##CLASS> data;                                            \
    /*set data*/                                                          \
    fillData(data, dataIn);                                               \
    /*create*/                                                            \
    create(*kdf, data);                                                   \
    /*clear data*/                                                        \
    data.clear();                                                         \
  }

  __SWITCH(classID, __CASE)
  

  //return output
  mxArray* ret = mxCreateNumericMatrix(1,1,mxINDEX_CLASS,mxREAL);
  *(Kdf**) mxGetPr(ret) = kdf;
  kdfOut = ret;
  
}
Example #14
0
void mexFunction( int nlhs, mxArray *plhs[],
                  int nrhs, const mxArray *prhs[])
{
   
  if (nrhs<3)	mexErrMsgTxt("Three inputs required");
  
  //get the lsh objcect
  Kdf* kdf = *(Kdf**)mxGetData(kdfIn);
  
  //get the class of points
  mxClassID classID = getClassID(pointsIn); 

  //get number of points in search data
  mwSize npoints = getNpoints(pointsIn);

  //number of nearest neighbors to return 
  uint k = (uint) *mxGetPr(kIn);
  
  //return all points -> return a cell array, otherwise returna matrix kxnpoints
  mxClassID retId;
  switch (numeric_limits<uint>::digits)
  {
    case 32: retId = mxUINT32_CLASS; break;
    case 64: retId = mxUINT64_CLASS; break;
  }
  
  //  mexPrintf("sizes are: %dx%d %dx%d\n", rows1, cols1, rows2, cols2);
  uint n1;
  #define __CASE(CLASS)                                                       \
  {                                                                           \
    /*datas*/                                                                 \
    Data<TYPEOF_##CLASS> points;                                              \
    fillData(points, pointsIn);                                               \
    /*allocate output*/                                                       \
    n1 = points.size();                                                       \
    /*return cell array*/                                                     \
    if (k == 0)                                                               \
      idsOut = mxCreateCellMatrix(1, n1);                                     \
    /*return array*/                                                          \
    else if (k > 0)                                                           \
      idsOut = mxCreateNumericMatrix((mwSize)k, (mwSize)n1, retId, mxREAL);   \
    /*loop*/                                                                  \
    KdtPointList pl;                                                          \
    for (uint i=0; i<n1; ++i)                                                 \
    {                                                                         \
      /*get ids*/                                                             \
      getIds(*kdf, points, i, pl);                                            \
      /*put back*/                                                            \
      fillPlist(idsOut, pl, i, k, retId);                                     \
    }                                                                         \
    /*clear memory*/                                                          \
    points.clear();                                                           \
  }

  __SWITCH(classID, __CASE)
 
}
Example #15
0
void edaSerialize::doSerialize(edaBuffer &buf, bool pack)
{
  if (pack)
  {
    int clsid = getClassID();

    buf.Pack(&clsid, 1);
  }

  this->Serialize(buf, pack);
}
Example #16
0
void ComponentGUIToggleButton::archive_write (Archive *archive)
{
    ComponentBase::archive_write(archive);

    archive->push_domain (getClassID ());
	
    *archive << ARCHIVE_PLUG(_sound_on, DATA_PERSISTENT | DATA_SETTABLE);
    *archive << ARCHIVE_PLUG(_sound_off, DATA_PERSISTENT | DATA_SETTABLE);

    archive->pop_domain ();
}
Example #17
0
void ComponentGUIToggleButton::archive_read (Archive *archive)
{
    ComponentBase::archive_read(archive);

	archive->push_domain (getClassID ());
        		
    if (archive->getVersion() >= 109) {
        *archive << ARCHIVE_PLUG(_sound_on, DATA_PERSISTENT | DATA_SETTABLE);
        *archive << ARCHIVE_PLUG(_sound_off, DATA_PERSISTENT | DATA_SETTABLE);
    }

    archive->pop_domain ();
}
Example #18
0
void ComponentGUIScrollerGrid::archive_read (Archive *archive)
{
    ComponentGUIScroller::archive_read(archive);

	archive->push_domain (getClassID ());
    
	*archive << ARCHIVE_DATA_ACCESSORS("Num_Columns", ComponentGUIScrollerGrid::getNumColumns, ComponentGUIScrollerGrid::setNumColumns, DATA_PERSISTENT | DATA_SETTABLE);
	*archive << ARCHIVE_DATA_ACCESSORS("Num_Rows", ComponentGUIScrollerGrid::getNumRows, ComponentGUIScrollerGrid::setNumRows, DATA_PERSISTENT | DATA_SETTABLE);
	*archive << ARCHIVE_DATA_ACCESSORS("Column_Width", ComponentGUIScrollerGrid::getColumnWidth, ComponentGUIScrollerGrid::setColumnWidth, DATA_PERSISTENT | DATA_SETTABLE);
	*archive << ARCHIVE_DATA_ACCESSORS("Row_Height", ComponentGUIScrollerGrid::getRowHeight, ComponentGUIScrollerGrid::setRowHeight, DATA_PERSISTENT | DATA_SETTABLE);
	*archive << ARCHIVE_DATA_ACCESSORS("Column_Padding", ComponentGUIScrollerGrid::getColumnPadding, ComponentGUIScrollerGrid::setColumnPadding, DATA_PERSISTENT | DATA_SETTABLE);
	*archive << ARCHIVE_DATA_ACCESSORS("Row_Padding", ComponentGUIScrollerGrid::getRowPadding, ComponentGUIScrollerGrid::setRowPadding, DATA_PERSISTENT | DATA_SETTABLE);
    
    archive->pop_domain ();
}
Example #19
0
/*
============
DropToFloor

plants the object on the floor
============
*/
void Item::DropToFloor( Event * )
{
	str fullname;
	Vector save;
	
	PlaceItem();
	
	addOrigin( Vector(0, 0, 1) );
	
	save = origin;
	
	if ( gravity > 0.0f )
	{
		if ( !droptofloor( 8192.0f ) )
		{
			gi.WDPrintf( "%s (%d) stuck in world at '%5.1f %5.1f %5.1f'\n",
				getClassID(), entnum, origin.x, origin.y, origin.z );
			setOrigin( save );
			setMoveType( MOVETYPE_NONE );
		}
		else
		{
			setMoveType( MOVETYPE_NONE );
		}
	}
	
	//
	// if the our global variable doesn't exist, lets zero it out
	//
	fullname = str( "playeritem_" ) + getName();
	if ( !gameVars.VariableExists( fullname.c_str() ) )
	{
		gameVars.SetVariable( fullname.c_str(), 0 );
	}
	
	if ( !levelVars.VariableExists( fullname.c_str() ) )
	{
		levelVars.SetVariable( fullname.c_str(), 0 );
	}

	if ( multiplayerManager.inMultiplayer() && gi.Anim_NumForName( edict->s.modelindex, "idle_onground" ) >= 0 )
	{
		animate->RandomAnimate( "idle_onground" );
		edict->s.eType = ET_MODELANIM;
	}
}
void KeyedSpriteAnimationEventTrack::archiveRead (Archive *archive)
{    
	BaseClass::archiveRead(archive);

    archive->pushDomain (getClassID ());

	DTsize keyframeCount;
	*archive << ARCHIVE_DATA(keyframeCount,DATA_PERSISTENT);
	_keyframes.resize(keyframeCount);
	
	for (DTuint i = 0; i < _keyframes.size(); ++i) {
		_keyframes[i].archiveRead(archive);
        _keyframes[i]._id = ++_id;
	}
	
    archive->popDomain ();
}
Example #21
0
bool ccObject::toFile(QFile& out) const
{
    assert(out.isOpen() && (out.openMode() & QIODevice::WriteOnly));

    //class ID (dataVersion>=20)
    //DGM: on 64 bits since version 34
    uint64_t classID = static_cast<uint64_t>(getClassID());
    if (out.write((const char*)&classID,8) < 0)
        return WriteError();

    //unique ID (dataVersion>=20)
    //DGM: this ID will be usefull to recreate dynamic links between entities!
    uint32_t uniqueID = (uint32_t)m_uniqueID;
    if (out.write((const char*)&uniqueID,4) < 0)
        return WriteError();

    //name (dataVersion>=22)
    {
        QDataStream outStream(&out);
        outStream << m_name;
    }

    //flags (dataVersion>=20)
    uint32_t objFlags = (uint32_t)m_flags;
    if (out.write((const char*)&objFlags,4) < 0)
        return WriteError();

    //meta data (dataVersion>=30)
    {
        //count
        uint32_t metaDataCount = (uint32_t)m_metaData.size();
        if (out.write((const char*)&metaDataCount,4) < 0)
            return WriteError();

        //"key + value" pairs
        QDataStream outStream(&out);
        for (QVariantMap::const_iterator it = m_metaData.begin(); it != m_metaData.end(); ++it)
        {
            outStream << it.key();
            outStream << it.value();
        }
    }

    return true;
}
Example #22
0
void ComponentGUIVideoPlayer::archive_write (Archive *archive)
{
    ComponentBase::archive_write(archive);

    archive->push_domain (getClassID ());
	
	*archive << ARCHIVE_PLUG(_file_or_url, DATA_PERSISTENT | DATA_SETTABLE);

	*archive << ARCHIVE_PLUG(_video_material, DATA_PERSISTENT | DATA_SETTABLE);
	*archive << ARCHIVE_PLUG(_play_material, DATA_PERSISTENT | DATA_SETTABLE);
	*archive << ARCHIVE_PLUG(_pause_material, DATA_PERSISTENT | DATA_SETTABLE);
	*archive << ARCHIVE_PLUG(_thumb_material, DATA_PERSISTENT | DATA_SETTABLE);
	*archive << ARCHIVE_PLUG(_track_loaded, DATA_PERSISTENT | DATA_SETTABLE);
	*archive << ARCHIVE_PLUG(_track_unloaded, DATA_PERSISTENT | DATA_SETTABLE);
	*archive << ARCHIVE_PLUG(_background, DATA_PERSISTENT | DATA_SETTABLE);

	*archive << ARCHIVE_DATA(_controls_size, DATA_PERSISTENT | DATA_SETTABLE);
	*archive << ARCHIVE_DATA(_track_size, DATA_PERSISTENT | DATA_SETTABLE);
	*archive << ARCHIVE_DATA(_thumb_size, DATA_PERSISTENT | DATA_SETTABLE);

    archive->pop_domain ();
}
void KeyedSpriteAnimationEventTrack::archiveWrite (Archive *archive)
{    
	BaseClass::archiveWrite(archive);

    archive->pushDomain (getClassID ());

	// Override settable flag
	DTuint flags = archive->getFlagsMask();
	archive->setFlagsMask( flags & (~DATA_SETTABLE) );

	DTsize keyframeCount = _keyframes.size();
	*archive << ARCHIVE_DATA(keyframeCount,DATA_PERSISTENT);

	for (DTsize i = 0; i < _keyframes.size(); ++i) {
		_keyframes[i].archiveRead(archive);
	}

	// Restore flags
	archive->setFlagsMask(flags);

    archive->popDomain ();
}
Example #24
0
bool ccHObject::isSerializable() const
{
	//we only handle pure CC_TYPES::HIERARCHY_OBJECT here (object groups)
	return (getClassID() == CC_TYPES::HIERARCHY_OBJECT);
}
void mexFunction( int nlhs, mxArray *plhs[],
                  int nrhs, const mxArray *prhs[])
{
  if (nrhs!=3)	mexErrMsgTxt("Three inputs required");
  
  //get the lsh objcect
  Lsh* lsh = *(Lsh**)mxGetData(lshIn);
  
  //get the class of points
  mxClassID classID = getClassID(pointsIn); 

  //get number of points
  mwSize npoints = getNpoints(pointsIn);

  //number of returns
  bool cellout = (bool) *mxGetPr(celloutIn);
  
  //create an array of LshPointList
  LshFuncValList* vals = new LshFuncValList[npoints];
  
  //now loop on the points and search
#define __CASE(CLASS)                                                   \
    {                                                                   \
    /*get the data*/                                                    \
    Data<TYPEOF_##CLASS> data;                                          \
    /*set data*/                                                        \
    fillData(data, pointsIn);                                           \
    /*insert*/                                                          \
    getFuncVal(*lsh, data, vals);                                       \
    /*clear data*/                                                      \
    data.clear();                                                       \
    }

  __SWITCH(classID, __CASE) 
  
  //allocate output data and get pointer
  //## change the type of this matlab type if uint is something other than unsigned int
  mxClassID retId;
  switch (numeric_limits<LshFuncVal_t>::digits)
  {
    case 32: retId = mxUINT32_CLASS; break;
    case 64: retId = mxUINT64_CLASS; break;
  }
  //check if to return cell: if requested by user, or if have more than one table
  //otherwise, we can just return a matrix where each column is for a point
  //and each row is for a function
  cellout = cellout || (lsh->opt.ntables > 1);
  
  //return all points -> return a cell array
  if (cellout)
    valsOut = mxCreateCellMatrix(1, npoints);
  //return an array
  else
    valsOut = mxCreateNumericMatrix((mwSize)lsh->opt.nfuncs, (mwSize)npoints, 
            retId, mxREAL);

  //loop on points and put output
  for (uint i=0; i<npoints; ++i)
  {
    //get pointer
    LshFuncVal_t* valsp;
    if (cellout)
    {
      //get cell array
      mxArray* pcell = mxCreateNumericMatrix(lsh->opt.nfuncs, lsh->opt.ntables, 
              retId, mxREAL);
      mxSetCell(valsOut, i, pcell);              
      //allocate
      valsp = (LshFuncVal_t*) mxGetPr(pcell);
    }
    else            
    {
      //get pointer
      valsp = (LshFuncVal_t*) mxGetPr(valsOut);
      valsp += lsh->opt.nfuncs*i;
    }
    
    //loop on lists
    for (uint j=0; j<vals[i].size(); ++j)
      //get value
      valsp[j] = vals[i][j];
    
    //clear this list
    vals[i].clear();
  }
  //clear list of plist
  delete [] vals;    
    
}
Example #26
0
void mexFunction( int nlhs, mxArray *plhs[],
                  int nrhs, const mxArray *prhs[])
{
   
  if (nrhs!=5)	mexErrMsgTxt("Five inputs required");
  
  //get the lsh objcect
  Lsh* lsh = *(Lsh**)mxGetData(lshIn);
  
  //get the class of points
  mxClassID classID = getClassID(lshPointsIn); 

  //get number of points in search data
  mwSize npoints = getNpoints(pointsIn);

  //number of nearest neighbors to return 
  uint k = (uint) *mxGetPr(kIn);
  
  //empty distance, then use the one inside the lsh
  DistanceType dist;
  if (mxIsEmpty(distIn))
    dist = lsh->opt.dist;
  else
  	dist = getDistanceType(distIn);
  

  //  mexPrintf("sizes are: %dx%d %dx%d\n", rows1, cols1, rows2, cols2);
  mxArray *dists, *ids;
  uint n1;
  #define __CASE(CLASS)                                                       \
  {                                                                           \
    /*datas*/                                                                 \
    Data<TYPEOF_##CLASS> lshPoints, points;                                   \
    fillData(lshPoints, lshPointsIn);                                         \
    fillData(points, pointsIn);                                               \
    /*allocate output*/                                                       \
    n1 = points.size();                                                       \
    dists = mxCreateNumericMatrix(k, n1, mxSINGLE_CLASS, mxREAL);             \
    ids = mxCreateNumericMatrix(k, n1, mxUINT32_CLASS, mxREAL);               \
    /*compute*/                                                               \
    getKnn(*lsh, lshPoints, points, k,  dist, (uint*) mxGetData(ids),         \
            (float*) mxGetData(dists));                                       \
    /*clear memory*/                                                          \
    lshPoints.clear();                                                        \
    points.clear();                                                           \
  }

  __SWITCH(classID, __CASE)

  
  
  //add one to the ids to make it Matlab compatible
  uint* idp = (uint*) mxGetData(ids);
  float* distp = (float*) mxGetData(dists);
  for (mwSize i=0; i<k*n1; ++i) 
  {
    if (distp[i] < numeric_limits<float>::infinity())
      idp[i] += 1;
  }
  idsOut = ids;
  
  if (nlhs>1) 
    distsOut = dists;  
}
void mexFunction( int nlhs, mxArray *plhs[],
                  int nrhs, const mxArray *prhs[])
{
   
  if (nrhs!=2)	mexErrMsgTxt("Two inputs required");
  
  //get the lsh objcect
  Lsh* lsh = *(Lsh**)mxGetData(lshIn);
  
  //get the class of points
  mxClassID classID = getClassID(pointsIn); 

  //get number of points
  mwSize npoints; // = getNpoints(pointsIn, true);
//   cout << "npoints:" << npoints << endl;

  //create an array of LshPointList
  BucketIdList* ids;
//   BucketIdList* ids = new BucketIdList[npoints];
  
  //now loop on the points and search
#define __CASE(CLASS)                                                   \
    {                                                                   \
    /*get the data*/                                                    \
    Data<TYPEOF_##CLASS> data;                                          \
    /*set data*/                                                        \
    fillData(data, pointsIn);                                           \
    /*allocate*/                                                        \
    npoints = data.size();                                              \
    ids = new BucketIdList[npoints];                                \
    /*insert*/                                                          \
    getBucketId(*lsh, data, ids);                                       \
    /*clear data*/                                                      \
    data.clear();                                                       \
    }

  __SWITCH(classID, __CASE) 
  
  //allocate output data and get pointer
  //## change the type of this matlab type if uint is something other than unsigned int
  mxClassID retId;
  switch (numeric_limits<BucketId_t>::digits)
  {
    case 32: retId = mxUINT32_CLASS; break;
    case 64: retId = mxUINT64_CLASS; break;
  }
  //return an array
  idsOut = mxCreateNumericMatrix(lsh->opt.ntables, npoints, retId, mxREAL);
  //pointer
  BucketId_t* idsp =  (BucketId_t*) mxGetPr(idsOut);
  
  //loop on points and put output  
  for (uint i=0; i<npoints; ++i)
  {
    for (uint j=0; j<ids[i].size(); ++j)
      idsp[i*lsh->opt.ntables + j] = ids[i][j]; 
    //clear this list
    ids[i].clear();
  }
  //clear list of plist
  delete [] ids;        
}