void	ExampleBrowserThreadFunc(void* userPtr,void* lsMemory)
{
	printf("thread started\n");

	ExampleBrowserThreadLocalStorage* localStorage = (ExampleBrowserThreadLocalStorage*) lsMemory;

	ExampleBrowserArgs* args = (ExampleBrowserArgs*) userPtr;
	int workLeft = true;
  b3CommandLineArgs args2(args->m_argc,args->m_argv);
	b3Clock clock;
	
	
	ExampleEntries examples;
	examples.initExampleEntries();

	ExampleBrowserInterface* exampleBrowser = new DefaultBrowser(&examples);
	bool init = exampleBrowser->init(args->m_argc,args->m_argv);
	clock.reset();
	if (init)
	{
		do 
		{
			float deltaTimeInSeconds = clock.getTimeMicroseconds()/1000000.f;
			clock.reset();
			exampleBrowser->update(deltaTimeInSeconds);

		} while (!exampleBrowser->requestedExit() && (args->m_cs->getSharedParam(0)!=eRequestTerminateExampleBrowser));
	}
	delete exampleBrowser;
	args->m_cs->lock();
	args->m_cs->setSharedParam(0,eExampleBrowserHasTerminated);
	args->m_cs->unlock();
	printf("finished\n");
	//do nothing
}
/**
Returns the contact item at the specified index into the view.
@capability ReadUserData
@param aIndex Index
*/
CViewContact* RContactRemoteView::ContactAtL(TInt aIndex)
    {
    const TContactItemId KUnknownContactId = -1;

    // 4 context switches
    TPckgBuf<TInt>pckg;
    TIpcArgs args(aIndex,&pckg);
    User::LeaveIfError(SendReceive(ECntViewContactAtLength,args));
    //
    CViewContact* contact = CViewContact::NewLC(KUnknownContactId);
    delete iContact;
    iContact = contact;
    CleanupStack::Pop(contact);
    //
    TInt contactLength=pckg();
    HBufC8* buf=HBufC8::NewLC(contactLength);
    TPtr8 bufPtr(buf->Des());
    TIpcArgs args2(&bufPtr);
    User::LeaveIfError(SendReceive(ECntViewContactAt,args2));
    RDesReadStream readStream(bufPtr);
    CleanupClosePushL(readStream);
    readStream >> *iContact;
    CleanupStack::PopAndDestroy(2); // readStream , buf.
    return iContact;
    }
Exemple #3
0
const char *
FE_get_cpp_args_from_env (void)
{
  const char *cpp_args = 0;

  // Added some customizable preprocessor options
  ACE_Env_Value<char*> args1 (ACE_TEXT ("TAO_IDL_PREPROCESSOR_ARGS"),
                              (char *) 0);

  if (args1 != 0)
    {
      cpp_args = args1;
    }
  else
    {
      // Check for the deprecated TAO_IDL_DEFAULT_CPP_FLAGS environment
      // variable.
      ACE_Env_Value<char*> args2 (ACE_TEXT ("TAO_IDL_DEFAULT_CPP_FLAGS"),
                                  (char *) 0);

      if (args2 != 0)
        {
          ACE_ERROR ((LM_WARNING,
                      "Warning: The environment variable "
                      "TAO_IDL_DEFAULT_CPP_FLAGS has been "
                      "deprecated.\n"
                      "         Please use "
                      "TAO_IDL_PREPROCESSOR_ARGS instead.\n"));

          cpp_args = args2;
        }
    }

  return cpp_args;
}
// -----------------------------------------------------------------------------
// RHssInterface::ShutdownServerL
// -----------------------------------------------------------------------------
//
EXPORT_C TInt RHssInterface::ShutdownServerL()
    {
    DEBUG( "RHssInterface::ShutdownServerL" );
    TInt ret( KErrNone );
    TInt iapId;
    TInt netId;
    TPckgBuf<TInt> iapPckg;
    TPckgBuf<TInt> netPckg;
    TIpcArgs args( &iapPckg, &netPckg );
    ret = SendReceive( EHssServerShutdown, args );
    
    if ( ret == KErrInUse )
        {
        iapId = iapPckg();
        netId = netPckg();
        DEBUG1("iapID RHSSINTERFACE : %d", iapId );
        ret = StopConnectionL( iapId, netId );
        
        if ( ret == KErrNone )
            {
            ret =  SendReceive( EHssServerShutdown, args );
            }
        }
    
    TIpcArgs args2( KHssShutdown ); 
    ret =  SendReceive( EHssServerShutdown, args2 );
        
    return ret;
    }
void ExprCopy::visit(const ExprApply& e) {
	for (int i=0; i<e.nb_args; i++)
		visit(e.arg(i));

	if (fold) {
		int i=0;
		for (; i<e.nb_args; i++) {
			if (!dynamic_cast<const ExprConstant*>(&ARG(i))) break;
		}
		if (i==e.nb_args) {
			Array<const Domain> d(e.nb_args);
			for (i=0; i<e.nb_args; i++) {
				d.set_ref(i,((const ExprConstant&) ARG(i)).get());
			}
			clone.insert(e, &ExprConstant::new_(Eval().eval(e.func,d)));
			return;
		}
	}

	Array<const ExprNode> args2(e.nb_args);
	for (int i=0; i<e.nb_args; i++) {
		args2.set_ref(i,ARG(i));
		// don't remove this node even if it is a constant because
		// it is an argument of this function call.
		mark(e.arg(i));
	}

	clone.insert(e, &ExprApply::new_(e.func, args2));
}
int main(int argc, char* argv[])
{
    // Duplicating the argument list. ticket:1246
    Ice::StringSeq args1 = Ice::argsToStringSeq(argc, argv);
    Ice::StringSeq args2(args1);
    Ice::InitializationData id1, id2;
    id1.properties = Ice::createProperties(args1);
    id2.properties = Ice::createProperties(args2);

    // Either
    omero::client client(id1);
    try {
        // Do something like
        // client.createSession();
    } catch (...) {
        client.closeSession();
    }

    //
    // Or
    //
    {
        omero::client_ptr client = new omero::client(id2);

        // Do something like
        // client->createSession();
    }
    // Client was destroyed via RAII

}
Exemple #7
0
 nestedTriangle(vector<matrix<double> > args) : Base() {
   int nargs=args.size();
   vector<matrix<double> > args1 = args.head(nargs-1);
   matrix<double> zero = args[0]*0.0;
   vector<matrix<double> > args2(nargs-1);
   for(int i=0;i<nargs-1;i++)args2[i] = zero;
   args2[0] = args[nargs-1];
   Base::A = nestedTriangle<n-1>(args1);
   Base::B = nestedTriangle<n-1>(args2);
 }
    void PeriodicTick(AuraEffect const* /*aurEff*/)
    {
        Unit* caster = GetCaster();
        if (!caster)
            return;

        CastSpellExtraArgs args1(TRIGGERED_FULL_MASK), args2(TRIGGERED_FULL_MASK);
        args1.AddSpellMod(SPELLVALUE_MAX_TARGETS, urand(1, 6));
        args2.AddSpellMod(SPELLVALUE_MAX_TARGETS, urand(1, 6));
        caster->CastSpell(GetTarget(), SPELL_SUMMON_PERIODIC_LIGHT, args1);
        caster->CastSpell(GetTarget(), SPELL_SUMMON_PERIODIC_DARK, args2);
    }
/**
Searches all contact items in the view for fields that contain the search
strings specified. 

@capability ReadUserData
@param aFindWords A descriptor array containing one or more search strings
@param aMatchedContacts On return, an array of matching contact items
@param find behaviour configuration uid to be passed to the server.
 */
void RContactRemoteView::ContactsMatchingCriteriaL(const MDesCArray& aFindWords, RPointerArray<CViewContact>& aMatchedContacts, TBool aPrefixSearch,TUid aUid)
    {
    if(aUid != KNullUid)
        {
        TIpcArgs args(aUid.iUid);
        User::LeaveIfError(SendReceive(ECntSendPluginUidToServer,args));
        }
    CBufBase* buffer = CBufFlat::NewL(32);
    CleanupStack::PushL(buffer);
    RBufWriteStream writeStream(*buffer);
    CleanupClosePushL(writeStream);

    writeStream.WriteUint32L(aPrefixSearch);
    const TInt count = aFindWords.MdcaCount();
    writeStream.WriteUint32L(count);
    for (TInt i=0; i<count; ++i)
        {
        TPtrC ptr = aFindWords.MdcaPoint(i);
        writeStream.WriteUint32L(ptr.Length());
        writeStream << ptr;
        }
    
    writeStream.CommitL();
    CleanupStack::PopAndDestroy(&writeStream); //writeStream.Close()

    TPtr8 ptr(buffer->Ptr(0));
    const TInt bufferSize = buffer->Size();
    TPckg<TInt> size(bufferSize);

    TPckgBuf<TInt> pckg;
    TIpcArgs args(&pckg,&size,&ptr);
    User::LeaveIfError(SendReceive(ECntContactMatchingCriteriaExternalizedSize,args));
    CleanupStack::PopAndDestroy(buffer);

    //Internalize Contacts
    HBufC8* buf=HBufC8::NewLC(pckg());
    TPtr8 contactsbufPtr(buf->Des());
    TIpcArgs args2(&contactsbufPtr);
    User::LeaveIfError(SendReceive(ECntGetContactMatchingCriteria,args2));

    RDesReadStream readStream(contactsbufPtr);
    CleanupClosePushL(readStream);
    const TInt findCount = readStream.ReadUint32L();
    for (TInt zz=0;zz<findCount;++zz)
        {
        CViewContact* thisContact = CViewContact::NewLC(KNullContactId);
        readStream >> *thisContact;
        aMatchedContacts.AppendL(thisContact);
        CleanupStack::Pop(thisContact);
        }
    CleanupStack::PopAndDestroy(2, buf);
    }
void ExprCopy::visit(const ExprChi& e) {  // TODO to check  Jordan: Gilles C. help me
	for (int i=0; i<e.nb_args; i++)
		visit(e.arg(i));

	Array<const ExprNode> args2(e.nb_args);
	for (int i=0; i<e.nb_args; i++) {
		args2.set_ref(i,ARG(i));
		// don't remove this node even if it is a constant because
		// it is an argument of this function call.
		mark(e.arg(i));
	}
	clone.insert(e, &ExprChi::new_(args2));
}
/**
@capability ReadUserData
*/
void RContactRemoteView::GetSortOrderL(RContactViewSortOrder& aSortOrder)
    {
    TPckgBuf<TInt> pckg;
    TIpcArgs args(&pckg);
    User::LeaveIfError(SendReceive(ECntViewSortOrderExternalizedSize,args));
    HBufC8* buf=HBufC8::NewLC(pckg());
    TPtr8 bufPtr(buf->Des());
    TIpcArgs args2(&bufPtr);
    User::LeaveIfError(SendReceive(ECntGetViewSortOrder,args2));
    RDesReadStream readStream(bufPtr);
    CleanupClosePushL(readStream);
    readStream >> aSortOrder;
    CleanupStack::PopAndDestroy(2); //readStream // buf.
    }
//Test7
TEST(ConstructorTest, TestInvalidDataARGV0)
{
	char ** arg2=0;
	bool isThrow = false;
	try
	{
		Arguments args2(2,arg2);
	}
	catch(int e)
	{
		isThrow = true;
	}
	EXPECT_EQ(true, isThrow);
} 
//Test6
TEST(ConstructorTest, TestInvalidDataARGCNegative)
{
	char * arg2[0] = {};
	bool isThrow = false;
	try
	{
		Arguments args2(-1,arg2);
	}
	catch(int e)
	{
		isThrow = true;
	}
	
	EXPECT_EQ(true, isThrow);
} 
/**
@capability ReadUserData
*/
HBufC* RContactRemoteView::AllFieldsLC(TInt aIndex,const TDesC& aSeparator) const
    {
    // 4 context switches
    TPckgBuf<TInt>pckg;
    TIpcArgs args(aIndex,&aSeparator,&pckg);
    User::LeaveIfError(SendReceive(ECntAllFieldsLength,args));
    TInt fieldLength = pckg();
    HBufC* buf=HBufC::NewLC(fieldLength);
    TPtr8 narrowBufPtr((TUint8*)buf->Ptr(),buf->Des().MaxLength()*2); // Note, must call MaxLength because the cell allocated may be larger than aLength.
    TIpcArgs args2(&narrowBufPtr);
    User::LeaveIfError(SendReceive(ECntAllFieldsText,args2));
    TPtr bufPtr(buf->Des());
    bufPtr.SetLength(narrowBufPtr.Length()/2);
    return buf;
    }
void ExprCopy::visit(const ExprVector& e) {
	for (int i=0; i<e.nb_args; i++)
		visit(e.arg(i));

	if (fold) {
		int i=0;
		for (; i<e.nb_args; i++) {
			if (!dynamic_cast<const ExprConstant*>(&ARG(i))) break;
		}
		if (i==e.nb_args) {
			if (e.dim.is_vector()) {
				IntervalVector v(e.dim.vec_size());
				for (i=0; i<e.nb_args; i++) {
					v[i]=((const ExprConstant&) ARG(i)).get_value();
				}
				clone.insert(e, &ExprConstant::new_vector(v,e.row_vector()));
			} else if (e.dim.type()==Dim::MATRIX) {
				IntervalMatrix m(e.dim.dim2,e.dim.dim3);
				for (i=0; i<e.nb_args; i++) {
					m.set_row(i,((const ExprConstant&) ARG(i)).get_vector_value());
				}
				clone.insert(e, &ExprConstant::new_matrix(m));
			} else {
				assert(e.dim.type()==Dim::MATRIX_ARRAY);
				IntervalMatrixArray ma(e.dim.dim1,e.dim.dim2,e.dim.dim3);
				for (i=0; i<e.nb_args; i++) {
					ma[i]=((const ExprConstant&) ARG(i)).get_matrix_value();
				}
				clone.insert(e, &ExprConstant::new_matrix_array(ma));
			}
			return;
		}
	}

	Array<const ExprNode> args2(e.nb_args);
	for (int i=0; i<e.nb_args; i++) {
		args2.set_ref(i,ARG(i));
		// don't remove this node even if it is a constant because
		// it is an element of this vector.
		mark(e.arg(i));
	}

	clone.insert(e, &ExprVector::new_(args2,e.row_vector()));
}
EXPORT_C TInt RMessagingTestUtilityServer::GetDirL(const TDesC& aPath, const TUint aEntryAttMask, const TUint aEntrySortKey, CDir*& aDir)
//
// Obtain directory information regardless of data caging.
// Caller is responsible for deleting CDir object as with RFs::GetDir().
//
	{	
	TPckgBuf<TUint> entryAttMask(aEntryAttMask);
	TPckgBuf<TUint> entrySortKey(aEntrySortKey);
	
	TIpcArgs args1(&aPath, &entryAttMask, &entrySortKey);

	TInt ret = SendReceive(EGetDir, args1);		//Create CDir object on the server.
	
	TPckgBuf<TUint> countBuf;
	TIpcArgs args2(&countBuf);

	ret = SendReceive(EGetDirCount, args2);		//Get the number of dir entries.
	
	TUint count = countBuf();
		
	
	CDirDerived* dirDerived = CDirDerived::NewL();	//Construct a new CDir from CDirDerived.

	TPckgBuf<TEntry> entryBuf;
	
	for (TUint i=0; i<count; i++)
	{
		TPckgBuf<TInt> indexBuf(i);
		TIpcArgs args3(&indexBuf, &entryBuf);
			
		ret = SendReceive(EGetDirEntry, args3);	//Get each dir entry from the server.
		
		TEntry entry = entryBuf();		
		
		dirDerived->AddL(entry);				//Add each entry to the client's CDir object.
	}

	aDir = dirDerived;							//Return pointer to client's CDir object.
	
	TInt c2 = aDir->Count();
			
	return KErrNone;
	}
    bool convertToMP3() const
    {
        TemporaryFile tempMP3 (".mp3");

        StringArray args2 (args);
        args2.add (tempWav.getFile().getFullPathName());
        args2.add (tempMP3.getFile().getFullPathName());

        DBG (args2.joinIntoString (" "));

        if (runLameChildProcess (tempMP3, args2))
        {
            FileInputStream fis (tempMP3.getFile());

            if (fis.openedOk() && output->writeFromInputStream (fis, -1) > 0)
            {
                output->flush();
                return true;
            }
        }

        return false;
    }