Exemple #1
0
T&  TUICore<T>::enable( bool beE = true )
{
    if ( isEnable() != beE )
    {
        if ( beE )
            _removeFlag( UF_DISABLE );
        else
            _addFlag( UF_DISABLE );

        _this()->onEnable( beE );
    }
    return *_this();
}
Exemple #2
0
T& TUICore<T>::setTop( bool beAlways )
{
    if ( beAlways )
        _addFlag( UF_STAY_TOP );

    if ( mNext )
    {
        getParent()->setTopChild( this , beAlways );
        _this()->onChangeOrder();
    }

    return *_this();
}
Exemple #3
0
T& TUICore<T>::setPos( Vec2i const& pos )
{
    Vec2i offset = pos - mBoundRect.min;

    mBoundRect.min = pos;
    mBoundRect.max += offset;

    _removeFlag( UF_WORLD_POS_VAILD );
    removeChildFlag( UF_WORLD_POS_VAILD );
    _this()->onChangePos( pos , true );

    return *_this();
}
Exemple #4
0
void TUICore<T>::doRenderAll()
{
    prevRender();
    render();
    postRender();

    bool bClipTest = _this()->haveChildClipTest();

    if ( bClipTest )
    {
        for( TUICore<T>* child = getChild(); child ; child = child->getNext() )
        {
            if ( !child->isShow() )
                continue;
            if ( !child->clipTest() )
                continue;
            child->renderAll();
        }
    }
    else
    {
        for( TUICore<T>* child = getChild(); child ; child = child->getNext() )
        {
            if ( !child->isShow() )
                continue;
            child->renderAll();
        }
    }
    postRenderChildren();
}
Exemple #5
0
void TUICore<T>::setTopChild( TUICore* ui , bool beAlways )
{
    assert( ui->mNext );

    if ( mChild == ui )
    {
        mChild = ui->mNext;
        mChild->mPrev = ui->mPrev;
    }
    else
    {
        ui->mPrev->mNext = ui->mNext;
        ui->mNext->mPrev = ui->mPrev;
    }

    assert( mChild );

    TUICore* lastUI = mChild->mPrev;
    assert( lastUI );

    lastUI->mNext = ui;
    ui->mPrev = lastUI;
    ui->mNext = NULL;

    mChild->mPrev = ui;

    if ( getManager()->getRoot() != this )
        _this()->onChangeChildrenOrder();
}
void HIDDevice::deviceRemovedCallback()
{
    Ptr<HIDDevice> _this(this); // prevent from release
    
    Ptr<DeviceCreateDesc> existingHIDDev = HIDManager->DevManager->FindHIDDevice(DevDesc, true);
    if (existingHIDDev && existingHIDDev->pDevice)
    {
        HIDManager->DevManager->CallOnDeviceRemoved(existingHIDDev);
    }
    closeDevice(true);
}
Exemple #7
0
T&  TUICore<T>::show( bool beS )
{
    if ( isShow() != beS )
    {
        if ( beS )
            _removeFlag( UF_BE_HIDDEN );
        else
            _addFlag( UF_BE_HIDDEN );

        _this()->onShow( beS );

        TUICore* ui = mChild;
        while ( ui )
        {
            ui->show( beS );
            ui = ui->mNext;
        }
    }
    return *_this();
}
Exemple #8
0
CORBA::Boolean
Foo_Impl::match_references ()
{
  CORBA::Object_var o = _this ();
  CORBA::ORB_var orb = o->_get_orb ();
  CORBA::String_var ior_from_upcall = orb->object_to_string (o.in());

  CORBA::Boolean r1 = equal_func (this->ior_from_main_.in(), ior_from_upcall.in());

  return r1;
}
Exemple #9
0
T& TUICore<T>::addChild( TUICore* ui )
{
    if ( ui->mParent )
        ui->_unlinkInternal();

    linkChildInternal( ui );

    ui->removeChildFlag( UF_WORLD_POS_VAILD );

    static_cast< T* >( ui )->onLink();

    return *_this();
}
void
File_impl::close ()
throw (CORBA::SystemException, CF::FileException)
{
    TRACE_ENTER(File_impl)
    boost::mutex::scoped_lock lock(interfaceAccess);

    int fsOpSuccessAttempts = 0;
    bool fsOpSuccess = false;
    while (!fsOpSuccess) {
        try {
            f.close();
            fsOpSuccess = true;
        } catch ( const fs::filesystem_error& ex ) {
            LOG_WARN(File_impl, "Error in filesystem: "<<ex.what()<<". Attempting again")
            fsOpSuccessAttempts++;
            if (fsOpSuccessAttempts == 10)
                { break; }
            usleep(10000);
        } catch ( ... ) {
            LOG_WARN(File_impl, "Caught an unhandled file system exception. Attempting again")
            fsOpSuccessAttempts++;
            if (fsOpSuccessAttempts == 10)
                { break; }
            usleep(10000);
        }
    }
    
    CF::File_var fileObj = _this();
    std::string fileIOR = ossie::corba::objectToString(fileObj);
    ptrFs->decrementFileIORCount(fullFileName, fileIOR);

    // clean up reference and clean up memory
    try {
        PortableServer::POA_var poa = ossie::corba::RootPOA()->find_POA("Files", 0);
        PortableServer::ObjectId_var oid = poa->servant_to_id(this);
        poa->deactivate_object(oid);
    } catch ( ... ) {

    }

    if (!fsOpSuccess) {
        LOG_ERROR(File_impl, "Error closing file, " << fName);
        throw (CF::File::IOException (CF::CF_EIO, "[File_impl::close] Error closing file"));
    }

    TRACE_EXIT(File_impl)
}
int PushSupplier_impl::init(RtecEventChannelAdmin::EventChannel_ptr channel)
{

    ACE_DEBUG((LM_DEBUG, "for_suppliers\n"));
    RtecEventChannelAdmin::SupplierAdmin_var supplier_admin =
        channel->for_suppliers();

    ACE_DEBUG((LM_DEBUG, "obtain_push_consumer\n"));
    consumer_ =
        supplier_admin->obtain_push_consumer();



    ACE_DEBUG((LM_DEBUG, "got push_consumer with %d profiles\n",
               consumer_->_stubobj ()->base_profiles ().profile_count ()));

    RtecEventChannelAdmin::SupplierQOS qos;
    qos.publications.length (1);
    RtecEventComm::EventHeader& h0 =
        qos.publications[0].event.header;
    h0.type   = ACE_ES_EVENT_UNDEFINED; // first free event type
    h0.source = 1;                      // first free event source

    RtecEventComm::PushSupplier_var supplier = _this();

    ACE_DEBUG((LM_DEBUG, "connect_push_supplier\n"));
    consumer_->connect_push_supplier(supplier.in(),
                                     qos);

    ACE_DEBUG((LM_DEBUG, "push_consumer connected\n"));


    if (!reactor_task_.thr_count() &&
            reactor_task_.activate (THR_NEW_LWP | THR_JOINABLE, 1) != 0)
        ACE_ERROR_RETURN ((LM_ERROR,
                           "Cannot activate reactor thread\n"),
                          -1);

    return 0;

}
Exemple #12
0
char *
Simple_Server_i::test_method (Simple_Server_ptr objref)
{
  ACE_DEBUG ((LM_DEBUG, "(%P|%t) test_method called\n"));
  if (CORBA::is_nil (objref))
    {
      ACE_ERROR ((LM_ERROR, "Nil object reference!\n"));
    }
  else
    {
      try
        {
          {
            ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0);
            if (!this->timer_registed_)
              {
                ACE_DEBUG ((LM_DEBUG, "(%P|%t) Scheduling timeout...\n"));
                ACE_Time_Value timeout (2, 0);
                ACE_Reactor * reactor = this->orb_->orb_core ()->reactor ();
                reactor->schedule_timer (this, (void*)0, timeout);
                this->timer_registed_ = true;
              }
          }
          ACE_DEBUG ((LM_DEBUG, "(%P|%t)  Calling test_method() on client, "
                      "which will sleep for 3 seconds\n"));
          CORBA::String_var str = objref->test_method (_this());
          ACE_DEBUG ((LM_DEBUG, "(%P|%t) Received \"%C\"\n", str.in ()));

        }
      catch (...)
        {
          ACE_ERROR ((LM_ERROR, "(%P|%t) Caught exception\n"));
        }
    }
  ACE_DEBUG ((LM_DEBUG, "(%P|%t) leaving test_method\n"));
  return CORBA::string_dup("Hello world");
}
Exemple #13
0
T& TUICore<T>::setFocus()
{
    getManager()->setFocusUI( this );
    return *_this();
}
Exemple #14
0
void *
PayloadSearchManager<WriterType>::hbfQueryThread(void *caller) {
	PayloadSearchManager<WriterType> *_this
		(reinterpret_cast<PayloadSearchManager<WriterType> *>(caller));

	// initialize read enumerator
	StrftimeReadEnumerator readEnum(_this->_inputDir,
									"%Y/%m/%d/hbf_%H",
									_this->_startTime,
									_this->_endTime);
	if (!readEnum) {
		_this->_error = true;
		_this->_errorMsg.assign("StrftimeReadEnumerator: ");
		_this->_errorMsg.append(readEnum.error());
		// lock results lock
		if (pthread_mutex_lock(&(_this->_resultsLock)) != 0) {
			// error
			_this->_error = true;
			_this->_errorMsg.assign("Unable to lock _resultsLock");
			return NULL;
		}
		_this->_hbfRunning = false;

		// signal condition for correlator thread
		if (pthread_cond_signal(&(_this->_resultsCondition)) != 0) {
			_this->_error = true;
			_this->_errorMsg.assign("Unable to signal _resultsCondition");
			return NULL;
		}

		// unlock results lock
		if (pthread_mutex_unlock(&(_this->_resultsLock)) != 0) {
			// error
			_this->_error = true;
			_this->_errorMsg.assign("Unable to unlock _resultsLock");
			return NULL;
		}
		return NULL;
	}

	HBFQueryProcessor
		<FlatFileReader
			<ZlibCompressedHBF>,
		 SetWriter
		 	<HBFResult>
		> processor;

	FlatFileReader <ZlibCompressedHBF> reader;

	std::set <HBFResult> *curResults;

	// for each file
	for (StrftimeReadEnumerator::const_iterator it(readEnum.begin());
		 it != readEnum.end();
		 ++it)
	{
		// initialize FlatFileReader
		if (reader.open(*it) != E_SUCCESS) {
			_this->_error = true;
			_this->_errorMsg.assign("FlatFileReader error");
			// lock results lock
			if (pthread_mutex_lock(&(_this->_resultsLock)) != 0) {
				// error
				_this->_error = true;
				_this->_errorMsg.assign("Unable to lock _resultsLock");
				return NULL;
			}
			_this->_hbfRunning = false;

			// signal condition for correlator thread
			if (pthread_cond_signal(&(_this->_resultsCondition)) != 0) {
				_this->_error = true;
				_this->_errorMsg.assign("Unable to signal _resultsCondition");
				return NULL;
			}

			// unlock results lock
			if (pthread_mutex_unlock(&(_this->_resultsLock)) != 0) {
				// error
				_this->_error = true;
				_this->_errorMsg.assign("Unable to unlock _resultsLock");
				return NULL;
			}
			return NULL;
		}

		// initialize SetWriter
		curResults = new std::set <HBFResult>;
		SetWriter <HBFResult> writer(*curResults);

		// initialize HBFQuery <FlatFileReader, SetWriter>
		processor.init(&reader,
					   &writer,
					   _this->_queryString,
					   _this->_queryLength,
					   _this->_matchLength,
					   _this->_flowMatcher,
					   _this->_maxMTU,
					   _this->_maxFlows,
					   _this->_hbfThreadCount);

		// hbfQuery.run()
		if (processor.run() != 0) {
			_this->_error = true;
			_this->_errorMsg.assign("HBFQueryProcessor: ");
			_this->_errorMsg.append(processor.error());
			// lock results lock
			if (pthread_mutex_lock(&(_this->_resultsLock)) != 0) {
				// error
				_this->_error = true;
				_this->_errorMsg.assign("Unable to lock _resultsLock");
				return NULL;
			}
			_this->_hbfRunning = false;

			// signal condition for correlator thread
			if (pthread_cond_signal(&(_this->_resultsCondition)) != 0) {
				_this->_error = true;
				_this->_errorMsg.assign("Unable to signal _resultsCondition");
				return NULL;
			}

			// unlock results lock
			if (pthread_mutex_unlock(&(_this->_resultsLock)) != 0) {
				// error
				_this->_error = true;
				_this->_errorMsg.assign("Unable to unlock _resultsLock");
				return NULL;
			}
			return NULL;
		}

		// lock results lock
		if (pthread_mutex_lock(&(_this->_resultsLock)) != 0) {
			// error
			_this->_error = true;
			_this->_errorMsg.assign("Unable to lock _resultsLock");
			return NULL;
		}
		// push_back set into _results
		_this->_results.push(curResults);

		// signal condition for correlator thread
		if (pthread_cond_signal(&(_this->_resultsCondition)) != 0) {
			_this->_error = true;
			_this->_errorMsg.assign("Unable to signal _resultsCondition");
			return NULL;
		}

		// unlock results lock
		if (pthread_mutex_unlock(&(_this->_resultsLock)) != 0) {
			// error
			_this->_error = true;
			_this->_errorMsg.assign("Unable to unlock _resultsLock");
			return NULL;
		}

		reader.close();
	}

	// lock results lock
	if (pthread_mutex_lock(&(_this->_resultsLock)) != 0) {
		// error
		_this->_error = true;
		_this->_errorMsg.assign("Unable to lock _resultsLock");
		return NULL;
	}
	_this->_hbfRunning = false;

	// signal condition for correlator thread
	if (pthread_cond_signal(&(_this->_resultsCondition)) != 0) {
		_this->_error = true;
		_this->_errorMsg.assign("Unable to signal _resultsCondition");
		return NULL;
	}

	// unlock results lock
	if (pthread_mutex_unlock(&(_this->_resultsLock)) != 0) {
		// error
		_this->_error = true;
		_this->_errorMsg.assign("Unable to unlock _resultsLock");
		return NULL;
	}

	return NULL;
}