示例#1
0
        SSLContext SSLObject::sslContext()
        {
            SSL_CTX* ctx = SSL_get_SSL_CTX(d_ssl.get());

            return SSLContext(std::shared_ptr<SSL_CTX>(ctx, null_deleter()));
        }
示例#2
0
文件: logging.hpp 项目: igsol/loglite
 format(log_element &e)
   : m_identifier("unnamed") 
 {
   boost::shared_ptr<loglite::log_element> p(&e, null_deleter());
   m_element_list.push_back(p);
 }
示例#3
0
文件: logging.hpp 项目: igsol/loglite
 format(log_element &e, const std::string &identifier) 
   : m_identifier(identifier) 
 {
   boost::shared_ptr<loglite::log_element> p(&e, null_deleter());
   m_element_list.push_back(p);
 }
示例#4
0
 /** Remove the child node.
  * @param el The child node to remove. This Node will be deleted and therefore unusable after calling this method.
  */
 void remove_child(xml_node* el) {child_list.remove(xml_nodeRef(el, null_deleter()));}
示例#5
0
exception_ptr result::make_no_result_error()
{
	static remote_error e(remote_error::no_result, "no result for one way call");
	return exception_ptr(&e, null_deleter());
}
示例#6
0
ControlDevice GetStreamDevice(std::istream & in, const std::string& name)
{ 
  boost::shared_ptr<std::istream> inp(&in, null_deleter());
  return ControlDevice(boost::shared_ptr<control_device_impl>(new istream_control_device_impl(inp,name)));
}
示例#7
0
QList<StreamerServicePtr> VideoImplService::getStreamerServices()
{
    QList<StreamerServicePtr> retval;
    QList<StreamerService *> services = mStreamerServiceListener->getServices();
    foreach(StreamerService* service, services)
    {
        if(service)
        {
            StreamerServicePtr temp(new StreamerServiceProxy(mBackend->mContext, service->getName()), null_deleter());
            retval.append(temp);
        }
    }
    return retval;
}
// -------------------------------------------------------------
// NonlinearSolverImplementation::solve
// -------------------------------------------------------------
void 
NonlinearSolverImplementation::solve(Vector &x) 
{
  p_X.reset(&x, null_deleter());
  this->p_solve();
}
示例#9
0
bool Image::load(QString path)
{
	ImagePtr self = ImagePtr(this, null_deleter());
	DataReaderWriter().readInto(self, path);
	return this->getBaseVtkImageData()!=0;
}
示例#10
0
void FiltersWidget::onServiceAdded(Filter* service)
{
    this->appendFilterIfWanted(FilterPtr(service, null_deleter()));
}
示例#11
0
	void XML::getOpArgs(const node_ptr script, block_ptr curBlock) {
		std::vector<std::string> args;
		std::vector<block_ptr> blockArgs;
		std::string opStr;
		int i(0);
		
		node_ptr tmpScript(script);
		
		if (std::strcmp(tmpScript->name(), "block") == 0 ||
			std::strcmp(tmpScript->name(), "list") == 0) {
			if (tmpScript->first_attribute("s")) {
				curBlock->setOpcode(tmpScript->first_attribute("s")->value());
			} else if (tmpScript->first_attribute("var")) {
				curBlock->setOpcode("readVariable");
				opStr = tmpScript->first_attribute("var")->value();
			} else if (tmpScript->first_attribute("point")) {
				curBlock->setOpcode("readPoint");
				opStr = tmpScript->first_attribute("point")->value();
			} else if (tmpScript->first_attribute("schedule")) {
				curBlock->setOpcode("reportGetSched");
				opStr = tmpScript->first_attribute("schedule")->value();
			}
			
			if (!opStr.empty()) {
				args.push_back(opStr);
			}
			
			const node_ptr first(tmpScript->first_node(), null_deleter());
			for (node_ptr child(first);
				 child;
				 child.reset(child->next_sibling(), null_deleter())) {
				if (std::strcmp(child->name(), "block") == 0 ||
					std::strcmp(child->name(), "script") == 0 ||
					std::strcmp(child->name(), "list") == 0) {
					block_ptr b(new blocks::Block);
					getOpArgs(child, b);
					if (b->opcode() == "nested") {
						curBlock->addNestedStart(b->nestedBlocks()[0]);
					} else if (b->opcode().empty()) {
						blockArgs = b->blockArgs();
					} else {
						opStr = "block:" + std::to_string(i++);
						blockArgs.push_back(b);
					}
				} else if (std::strcmp(child->name(), "l") == 0) {
					if (child->first_node() != 0) {
						opStr = child->value();
					} else {
						opStr = child->first_node("option")->value();
					}
				}
				
				if (!opStr.empty()) {
					args.push_back(opStr);
				}
			}
		} else if (std::strcmp(tmpScript->name(), "script") == 0) {
			curBlock->setOpcode("nested");
			node_ptr child(tmpScript->first_node(), null_deleter());
			curBlock->addNestedStart(getChildren(child, true));
		}
		
		if (args.size() > 0) curBlock->setArgs(args);
		if (blockArgs.size() > 0) curBlock->setBlockArgs(blockArgs);
	}
示例#12
0
Cell::Cell(boost::shared_ptr<AbstractCellProperty> pMutationState,
           AbstractCellCycleModel* pCellCycleModel,
           AbstractSrnModel* pSrnModel,
           bool archiving,
           CellPropertyCollection cellPropertyCollection)
    : mCanDivide(false),
      mCellPropertyCollection(cellPropertyCollection),
      mpCellCycleModel(pCellCycleModel),
      mpSrnModel(pSrnModel),
      mDeathTime(DBL_MAX), // This has to be initialised for archiving
      mStartOfApoptosisTime(DBL_MAX),
      mApoptosisTime(0.25), // cell takes 15 min to fully undergo apoptosis
      mUndergoingApoptosis(false),
      mIsDead(false),
      mIsLogged(false)
{
    if (SimulationTime::Instance()->IsStartTimeSetUp()==false)
    {
        EXCEPTION("Cell is setting up a cell-cycle model but SimulationTime has not been set up");
    }

    if (pCellCycleModel == NULL)
    {
        EXCEPTION("Cell-cycle model is null");
    }

    mpCellCycleModel->SetCell(CellPtr(this, null_deleter()));

    // Create a null srn model if none given
    if (pSrnModel == NULL)
    {
        pSrnModel = new NullSrnModel;
        mpSrnModel = pSrnModel;
    }

    mpSrnModel->SetCell(CellPtr(this, null_deleter()));

    if (!mCellPropertyCollection.HasPropertyType<CellId>())
    {
        // Set cell identifier this will be called all the time unless the constructor is called through archiving
        MAKE_PTR(CellId, p_cell_id);
        p_cell_id->AssignCellId();
        mCellPropertyCollection.AddProperty(p_cell_id);
    }

    if (!pMutationState->IsSubType<AbstractCellMutationState>())
    {
        EXCEPTION("Attempting to create cell with a cell mutation state that is not a subtype of AbstractCellMutationState");
    }

    if (!mCellPropertyCollection.HasProperty(pMutationState))
    {
        mCellPropertyCollection.AddProperty(pMutationState);
    }

    if (!mCellPropertyCollection.HasPropertyType<CellData>())
    {
        // Add empty cell data
        MAKE_PTR(CellData, p_cell_data);
        mCellPropertyCollection.AddProperty(p_cell_data);
    }

    /*
     * If a cell proliferative type was not passed in via the input
     * argument cellPropertyCollection (for example as in the case
     * of a daughter cell being created following division) then add
     * add a 'default' cell proliferative type to the cell property
     * collection. This ensures that the method GetCellProliferativeType()
     * always returns a valid proliferative type.
     */
    if (!mCellPropertyCollection.HasPropertyType<AbstractCellProliferativeType>())
    {
        mCellPropertyCollection.AddProperty(CellPropertyRegistry::Instance()->Get<DefaultCellProliferativeType>());
    }

    if (!archiving)
    {
        // Increment cell count for each cell property in mCellPropertyCollection
        for (CellPropertyCollection::Iterator property_iter = mCellPropertyCollection.Begin();
             property_iter != mCellPropertyCollection.End();
             ++property_iter)
        {
            (*property_iter)->IncrementCellCount();
        }
    }
}
void NodeBasedCellPopulation<DIM>::NonBlockingSendCellsToNeighbourProcesses()
{
    if (!PetscTools::AmTopMost())
    {
        boost::shared_ptr<std::vector<std::pair<CellPtr, Node<DIM>* > > > p_cells_right(&mCellsToSendRight, null_deleter());
        int tag = SmallPow(2u, 1+ PetscTools::GetMyRank() ) * SmallPow (3u, 1 + PetscTools::GetMyRank() + 1);
        mRightCommunicator.ISendObject(p_cells_right, PetscTools::GetMyRank() + 1, tag);
    }
    if (!PetscTools::AmMaster())
    {
        int tag = SmallPow (2u, 1 + PetscTools::GetMyRank() ) * SmallPow (3u, 1 + PetscTools::GetMyRank() - 1);
        boost::shared_ptr<std::vector<std::pair<CellPtr, Node<DIM>* > > > p_cells_left(&mCellsToSendLeft, null_deleter());
        mLeftCommunicator.ISendObject(p_cells_left, PetscTools::GetMyRank() - 1, tag);
    }
    // Now post receives to start receiving data before returning.
    if (!PetscTools::AmTopMost())
    {
        int tag = SmallPow (3u, 1 + PetscTools::GetMyRank() ) * SmallPow (2u, 1+ PetscTools::GetMyRank() + 1);
        mRightCommunicator.IRecvObject(PetscTools::GetMyRank() + 1, tag);
    }
    if (!PetscTools::AmMaster())
    {
        int tag = SmallPow (3u, 1 + PetscTools::GetMyRank() ) * SmallPow (2u, 1+ PetscTools::GetMyRank() - 1);
        mLeftCommunicator.IRecvObject(PetscTools::GetMyRank() - 1, tag);
    }
}
void NodeBasedCellPopulation<DIM>::SendCellsToNeighbourProcesses()
{
    MPI_Status status;

    if (!PetscTools::AmTopMost())
    {
        boost::shared_ptr<std::vector<std::pair<CellPtr, Node<DIM>* > > > p_cells_right(&mCellsToSendRight, null_deleter());
        mpCellsRecvRight = mRightCommunicator.SendRecvObject(p_cells_right, PetscTools::GetMyRank() + 1, mCellCommunicationTag, PetscTools::GetMyRank() + 1, mCellCommunicationTag, status);
    }
    if (!PetscTools::AmMaster())
    {
        boost::shared_ptr<std::vector<std::pair<CellPtr, Node<DIM>* > > > p_cells_left(&mCellsToSendLeft, null_deleter());
        mpCellsRecvLeft = mLeftCommunicator.SendRecvObject(p_cells_left, PetscTools::GetMyRank() - 1, mCellCommunicationTag, PetscTools::GetMyRank() - 1, mCellCommunicationTag, status);
    }
}
示例#15
0
 /**
  * Sets the stream.
  */
 void setStream(std::ostream& aStream) {
   setStreamImpl(shared_ptr<std::ostream>(&aStream, null_deleter()));
 };
示例#16
0
///This function checks if a typeID is parent to this.
so_type::weak_pointer RK_CALL so_type_impl::findAncestor_impl(const unsigned int* aTypeID ) const {
  if( compare_equal(aTypeID, this->TypeID_begin()) ) 
    return rk_static_ptr_cast<so_type>(mThis);
    
  if(mAncestors.empty())
    return so_type::weak_pointer();
  
  detail::dummy_so_type d(aTypeID);
  std::set< so_type::weak_pointer, so_type_impl::compare_weak_t>::const_iterator it = mAncestors.lower_bound(so_type::shared_pointer(&d,null_deleter()));
  
  if((it != mAncestors.end()) && (it->lock()) && (compare_equal(it->lock()->TypeID_begin(),aTypeID))) 
    return *it;
  
  for(it = mAncestors.begin(); it != mAncestors.end(); ++it) {
    if(it->lock()) {
      so_type::weak_pointer p = it->lock()->findAncestor(aTypeID);
      if(p.lock())
        return p;
    };
  };
  
  return so_type::weak_pointer();
};
示例#17
0
 /// Create compatible render context
 RenderContext::RenderContext(QGLWidget * widget)
 {
   /// Dirty hack, but we'll use it with caution, I promise.
   m_context = shared_ptr<QGLContext>(const_cast<QGLContext*>(widget->context()), null_deleter());
 }
示例#18
0
StreamerServicePtr VideoServiceNull::getStreamerService(QString uid)
{
    return StreamerServicePtr(new StreamerServiceNull() , null_deleter());
}
示例#19
0
ControlDevice GetDuplexControlDevice(std::istream& in1,
				     const char* filename, const std::string& name) {
  boost::shared_ptr<std::istream> in1p(&in1, null_deleter());
  boost::shared_ptr<std::istream> in2p(new std::ifstream(filename));
  return ControlDevice(boost::shared_ptr<control_device_impl>(new multi_istream_control_device(in1p,in2p,name)));
}
void StreamerServiceProxy::onServiceAdded(StreamerService* service)
{
    if(service && service->getName() == mServiceName)
        mStreamerService.reset(service, null_deleter());
}