コード例 #1
0
ファイル: Blobs02.cpp プロジェクト: MrMdR/julapy
void Blobs02 :: initBox2d()
{
	box2d.init();
	box2d.setGravity( 0, 0 );
	box2d.checkBounds( true );
	box2d.createBounds( renderArea.x, renderArea.y, renderArea.width, renderArea.height );
	box2d.setFPS( 30.0 );
	
	addBlob( ofGetWidth() * 0.5f, ofGetHeight() * 0.5f, 200, 8 );

//	float ballMin = 30;
//	float ballMax = 80;
//	addBall( ofGetWidth() * 0.5f, ofGetHeight() * 0.5f, ofRandom( ballMin, ballMax ) );
//	addBall( ofGetWidth() * 0.5f, ofGetHeight() * 0.5f, ofRandom( ballMin, ballMax ) );
//	addBall( ofGetWidth() * 0.5f, ofGetHeight() * 0.5f, ofRandom( ballMin, ballMax ) );
//	addBall( ofGetWidth() * 0.5f, ofGetHeight() * 0.5f, ofRandom( ballMin, ballMax ) );
//	addBall( ofGetWidth() * 0.5f, ofGetHeight() * 0.5f, ofRandom( ballMin, ballMax ) );
//	addBall( ofGetWidth() * 0.5f, ofGetHeight() * 0.5f, ofRandom( ballMin, ballMax ) );
//	addBall( ofGetWidth() * 0.5f, ofGetHeight() * 0.5f, ofRandom( ballMin, ballMax ) );
//	addBall( ofGetWidth() * 0.5f, ofGetHeight() * 0.5f, ofRandom( ballMin, ballMax ) );
//	addBall( ofGetWidth() * 0.5f, ofGetHeight() * 0.5f, ofRandom( ballMin, ballMax ) );
//	addBall( ofGetWidth() * 0.5f, ofGetHeight() * 0.5f, ofRandom( ballMin, ballMax ) );
//	addBall( ofGetWidth() * 0.5f, ofGetHeight() * 0.5f, ofRandom( ballMin, ballMax ) );
//	addBall( ofGetWidth() * 0.5f, ofGetHeight() * 0.5f, ofRandom( ballMin, ballMax ) );
//	addBall( ofGetWidth() * 0.5f, ofGetHeight() * 0.5f, ofRandom( ballMin, ballMax ) );
	
	bDrawNodes	= false;
	bDrawJoints	= false;
	bDrawCurves	= true;
}
コード例 #2
0
ファイル: fileRepository.c プロジェクト: buccella/SFCB
int
main()
{
  if (existingNameSpace(ns) == 0) {
    printf("--- namspace %s does not exist\n", ns);
    exit(1);
  }
  addBlob(ns, "class1", o1, o1, strlen(o1));
  addBlob(ns, "class1", o2, o2, strlen(o2));
  addBlob(ns, "class1", o3, o3, strlen(o3));
  addBlob(ns, "class1", o4, o4, strlen(o4));
  addBlob(ns, "class1", o2, o2, strlen(o2));
  deleteBlob(ns, "class1", o2);
  deleteBlob(ns, "class1", o1);
  deleteBlob(ns, "class1", o4);
  printf("--- %s\n", (char *) getBlob(ns, "class1", o3, NULL));
  deleteBlob(ns, "class1", o3);
}
コード例 #3
0
CMPIStatus
InternalProviderModifyInstance(CMPIInstanceMI * mi,
                               const CMPIContext *ctx,
                               const CMPIResult *rslt,
                               const CMPIObjectPath * cop,
                               const CMPIInstance *ci,
                               const char **properties)
{
  CMPIStatus      st = { CMPI_RC_OK, NULL };
  unsigned long   len;
  void           *blob;
  CMPIString     *cn = CMGetClassName(cop, NULL);
  CMPIString     *ns = CMGetNameSpace(cop, NULL);
  char           *key = normalizeObjectPathCharsDup(cop);
  const char     *nss = ns->ft->getCharPtr(ns, NULL);
  const char     *cns = cn->ft->getCharPtr(cn, NULL);
  const char     *bnss = repositoryNs(nss);
  const char    **keyList;

  _SFCB_ENTER(TRACE_INTERNALPROVIDER, "InternalProviderSetInstance");

  if (testNameSpace(bnss, &st) == 0) {
    free(key);
    _SFCB_RETURN(st);
  }

  if (existingBlob(bnss, cns, key) == 0) {
    CMPIStatus      st = { CMPI_RC_ERR_NOT_FOUND, NULL };
    free(key);
    _SFCB_RETURN(st);
  }

  if (properties) {
    keyList = getKeyList(ci->ft->getObjectPath(ci, NULL));
    ci->ft->setPropertyFilter((CMPIInstance *) ci, properties, keyList);
    if (keyList) {
      free(keyList);
    }
  }

  len = getInstanceSerializedSize(ci);
  blob = malloc(len + 64);
  getSerializedInstance(ci, blob);
  addBlob(bnss, cns, key, blob, (int) len);
  free(blob);
  free(key);
  _SFCB_RETURN(st);
}
コード例 #4
0
ファイル: backend_sfcb.c プロジェクト: buccella/mofc
int sfcb_add_qualifier(qual_entry * q, const char * ns)
{
	ClQualifierDeclaration * qual;
	CMPIQualifierDecl * cmpi_qual = malloc(sizeof(CMPIQualifierDecl));
	void * blob;
	int len, size;
	CMPIData d;
	
	qual = ClQualifierDeclarationNew(ns, q->qual_id);
	qual->type = make_cmpi_type(q->qual_type, q->qual_array);
	d = make_cmpi_data(q->qual_type, q->qual_array, q->qual_defval);
	ClQualifierAddQualifier(&qual->hdr, &qual->qualifierData, q->qual_id, d);
	
	//negate the 2 to match obejctImpl's representation
	if(q->qual_attrs.flavor & Qual_F_DisableOverride)
		q->qual_attrs.flavor &= ~ Qual_F_DisableOverride;
	else
		q->qual_attrs.flavor |= Qual_F_DisableOverride;
	if(q->qual_attrs.flavor & Qual_F_Restricted)
		q->qual_attrs.flavor &= ~ Qual_F_Restricted;
	else
		q->qual_attrs.flavor |= Qual_F_Restricted;
		
	qual->flavor = q->qual_attrs.flavor;
	qual->scope = q->qual_attrs.scope;

	cmpi_qual->hdl=qual;
 	len=getQualifierSerializedSize(cmpi_qual);
 	blob=malloc(len);
	getSerializedQualifier(cmpi_qual,blob);
	
    if (swapMode) {
		size=((ClQualifierDeclaration *)((CMPIQualifierDecl * )blob)->hdl)->hdr.size;
		int offset = len-size;
		qual = swapEntryQualifier(blob+offset,&size);
		len = offset + size;
		blob = realloc(blob, len);
		memcpy(blob+offset, qual, size);
		free(qual);
    }

	if (addBlob((char*)ns, "qualifiers", q->qual_id, blob,(int)len)) {
		fprintf(stderr,"could not write qualifier %s\n",q->qual_id);
		return 1;
	}
	free(blob);		
	return 0;
}
コード例 #5
0
ファイル: ofApp.cpp プロジェクト: erikparr/Landscapes
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
    if (key==' ') {
        playMode = 0;
        tStampTime = 1*1000; //1 sec
        wTimeStamp = ofGetElapsedTimef();
    }
    if(key=='q')
        clearBlobs();
    
    if (key=='b') {
        if(playMode==1)
            resetAllSolenoids();
        
        tStampTime = 60*1000; //60 seconds
        addBlob();
        playMode=1;
    }
}
コード例 #6
0
ファイル: cluster.cpp プロジェクト: androidsoft/kiwix_mirror
 void ClusterImpl::addBlob(const char* data, unsigned size)
 {
   addBlob(Blob(data, size));
 }
コード例 #7
0
CMPIStatus
InternalProviderCreateInstance(CMPIInstanceMI * mi,
                               const CMPIContext *ctx,
                               const CMPIResult *rslt,
                               const CMPIObjectPath * cop,
                               const CMPIInstance *ci)
{
  CMPIStatus      st = { CMPI_RC_OK, NULL };
  unsigned long   len;
  void           *blob;
  CMPIString     *cn = CMGetClassName(cop, NULL);
  CMPIString     *ns = CMGetNameSpace(cop, NULL);
  char           *key = normalizeObjectPathCharsDup(cop);
  const char     *nss = ns->ft->getCharPtr(ns, NULL);
  const char     *cns = cn->ft->getCharPtr(cn, NULL);
  const char     *bnss = repositoryNs(nss);

  _SFCB_ENTER(TRACE_INTERNALPROVIDER, "InternalProviderCreateInstance");

  if (testNameSpace(bnss, &st) == 0) {
    free(key);
    _SFCB_RETURN(st);
  }

  CMPIConstClass *cc = getConstClass(nss, cns);
  /*
   * per DSP0004 2.5.2 
   */
  if (cc != NULL && cc->ft->isAbstract(cc) != 0) {
    CMPIStatus      st = { CMPI_RC_ERR_NOT_SUPPORTED, NULL };
    free(key);
    _SFCB_RETURN(st);
  }

  if (existingBlob(bnss, cns, key)) {
    CMPIStatus      st = { CMPI_RC_ERR_ALREADY_EXISTS, NULL };
    free(key);
    _SFCB_RETURN(st);
  }

  len = getInstanceSerializedSize(ci);
  blob = malloc(len + 64);
  getSerializedInstance(ci, blob);

  if (addBlob(bnss, cns, key, blob, (int) len)) {
    CMPIStatus      st = { CMPI_RC_ERR_FAILED, NULL };
    st.msg =
        sfcb_native_new_CMPIString("Unable to write to repository", NULL,
                                   0);
    free(blob);
    free(key);
    _SFCB_RETURN(st);
  }
  free(blob);

  if (rslt) {
    CMReturnObjectPath(rslt, cop);
  }

  free(key);
  _SFCB_RETURN(st);
}
コード例 #8
0
ファイル: backend_sfcb.c プロジェクト: buccella/mofc
int sfcb_add_instance(class_entry * ie, const char * ns)
{	
	void * blob;
	int len, size;
	CMPIData data;
	class_entry * ce=NULL; //class definition for instance ie
	CMPIObjectPath * path;
	ClInstance * inst;
	CMPIInstance* cmpi_instance = malloc(sizeof(CMPIInstance));
	prop_chain * class_prop;
	prop_chain * inst_props = ie -> class_props;
	
	ce = get_class_def_for_instance(ie);
	if(!ce) {
		//class def not found
		fprintf(stderr,"class definition for %s not found\n",
			ie->class_id);
		return 1;
	}

	path = mofc_getObjectPath(ce, ie, ns);
	//	fprintf(stderr, "add_inst: OP= %s\n", CMGetCharPtr(path->ft->toString(path, NULL)));

    if (ie->instmig)
    	inst = ClInstanceNew(ns, ie->class_id);
    else
    	inst = ClInstanceNewFromMof(ns, ie->class_id);

    while (inst_props) {
		if (sfcb_options & BACKEND_VERBOSE) {
			fprintf(stderr,"add_inst:  adding property %s for instance %s \n", 
			inst_props -> prop_id, ie -> class_id );
		}
		class_prop = check_for_prop(ce, inst_props->prop_id);
		if (!class_prop && opt_reduced) {
		  class_prop = check_for_parent_prop(ce, inst_props->prop_id);
		}
		if (!class_prop) {
		  fprintf(stderr, "bad property name \"%s\" for %s\n", inst_props->prop_id, inst_props->prop_class);
		  return 1;
		}
		data = make_cmpi_data(class_prop->prop_type, class_prop->prop_array, inst_props->prop_value);
		ClInstanceAddProperty(inst, inst_props->prop_id, data);
		inst_props = inst_props->prop_next;
    }

	cmpi_instance->hdl=inst;
 	len=getInstanceSerializedSize(cmpi_instance);
 	blob=malloc(len);
	getSerializedInstance(cmpi_instance,blob);

    if (swapMode) {
		size=((ClInstance *)((CMPIInstance * )blob)->hdl)->hdr.size;
		int offset = len-size;
		inst = swapEntryInstance(blob+offset,&size);
		len = offset + size;
		blob = realloc(blob, len);
		memcpy(blob+offset, inst, size);
		free(inst);
    }
	
	if (addBlob((char*)ns,ie->class_id,normalizeObjectPathChars(path),blob,(int)len)) {
		fprintf(stderr,"could not write instance for class definition %s\n",ie->class_id);
		return 1;
	}
	free(blob);
	return 0;
}