当前位置: 首页>>代码示例>>C++>>正文


C++ Factory类代码示例

本文整理汇总了C++中Factory的典型用法代码示例。如果您正苦于以下问题:C++ Factory类的具体用法?C++ Factory怎么用?C++ Factory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Factory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

QDebug operator<<(QDebug debug,
                  const Factory &rFactory)
{
    debug.nospace() << "Factory("
                    << "appenderfactories:" << rFactory.registeredAppenders()
                    << "filterfactories:" << rFactory.registeredFilters()
                    << "layoutfactories:" << rFactory.registeredLayouts()
                    << ")";
    return debug.space();
}
开发者ID:DenisVerkhovsky,项目名称:Log4Qt,代码行数:10,代码来源:factory.cpp

示例2: write

 bool ParameterContainer::write(std::ostream& os) const{
   Factory* factory = Factory::instance();
   for (const_iterator it=begin(); it!=end(); it++){
     os << factory->tag(it->second) << " ";
     os << it->second->id() << " ";
     it->second->write(os);
     os << endl;
   }
   return true;
 }
开发者ID:2maz,项目名称:g2o,代码行数:10,代码来源:parameter_container.cpp

示例3: get_client

// gets client
Client* get_client()
{
    Factory *factory =
        Factory::instance();
    KLKASSERT(factory != NULL);
    Client *client = factory->getClient();
    KLKASSERT(client != NULL);

    return client;
}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例4: sn_squashstretch2_op_Define

///////////////////////////////////////////////////////////////
// SQUASH STRETCH 2
///////////////////////////////////////////////////////////////
// Define =====================================================
XSIPLUGINCALLBACK CStatus sn_squashstretch2_op_Define( CRef& in_ctxt )
{
   Context ctxt( in_ctxt );
   CustomOperator oCustomOperator;
   Parameter oParam;
   CRef oPDef;
   Factory oFactory = Application().GetFactory();
   oCustomOperator = ctxt.GetSource();

   oPDef = oFactory.CreateParamDef(L"blend",CValue::siDouble,siPersistable | siAnimatable,L"",L"",1,0,1,0,1);
   oCustomOperator.AddParameter(oPDef,oParam);
   oPDef = oFactory.CreateParamDef(L"driver",CValue::siDouble,siPersistable | siAnimatable,L"",L"",0,-100000,100000,0,24);
   oCustomOperator.AddParameter(oPDef,oParam);

   oPDef = oFactory.CreateParamDef(L"driver_min",CValue::siDouble,siPersistable | siAnimatable,L"",L"",0,-100000,100000,0,1);
   oCustomOperator.AddParameter(oPDef,oParam);
   oPDef = oFactory.CreateParamDef(L"driver_ctr",CValue::siDouble,siPersistable | siAnimatable,L"",L"",5,-100000,100000,0,1);
   oCustomOperator.AddParameter(oPDef,oParam);
   oPDef = oFactory.CreateParamDef(L"driver_max",CValue::siDouble,siPersistable | siAnimatable,L"",L"",10,-100000,100000,0,1);
   oCustomOperator.AddParameter(oPDef,oParam);

   oPDef = oFactory.CreateParamDef(L"axis",CValue::siInt4,siPersistable | siAnimatable,L"",L"",0,0,2,0,2);
   oCustomOperator.AddParameter(oPDef,oParam);

   oPDef = oFactory.CreateParamDef(L"squash",CValue::siDouble,siPersistable | siAnimatable,L"",L"",0,-1,1,-1,1);
   oCustomOperator.AddParameter(oPDef,oParam);
   oPDef = oFactory.CreateParamDef(L"stretch",CValue::siDouble,siPersistable | siAnimatable,L"",L"",0,-1,1,-1,1);
   oCustomOperator.AddParameter(oPDef,oParam);

   oCustomOperator.PutAlwaysEvaluate(false);
   oCustomOperator.PutDebug(0);
   return CStatus::OK;
}
开发者ID:EricTRocks,项目名称:GEAR_mc,代码行数:37,代码来源:sn_squashstretch_op.cpp

示例5: sn_null2curve_op_Define

///////////////////////////////////////////////////////////////
// NULL 2 CURVE
///////////////////////////////////////////////////////////////
// Define =====================================================
XSIPLUGINCALLBACK CStatus sn_null2curve_op_Define( CRef& in_ctxt )
{
   Context ctxt( in_ctxt );
   CustomOperator op;
   Parameter param;
   CRef pdef;
   Factory oFactory = Application().GetFactory();
   op = ctxt.GetSource();
   pdef = oFactory.CreateParamDef(L"blend",CValue::siDouble,siPersistable | siAnimatable,L"",L"",0,0,1,0,1);
   op.AddParameter(pdef,param);
   pdef = oFactory.CreateParamDef(L"u",CValue::siDouble,siPersistable | siAnimatable,L"",L"",.5,0,1,0,1);
   op.AddParameter(pdef,param);
   pdef = oFactory.CreateParamDef(L"imin",CValue::siDouble,siPersistable | siAnimatable,L"",L"",0,0,1,0,1);
   op.AddParameter(pdef,param);
   pdef = oFactory.CreateParamDef(L"imax",CValue::siDouble,siPersistable | siAnimatable,L"",L"",1,0,1,0,1);
   op.AddParameter(pdef,param);
   pdef = oFactory.CreateParamDef(L"omin",CValue::siDouble,siPersistable | siAnimatable,L"",L"",0,0,1,0,1);
   op.AddParameter(pdef,param);
   pdef = oFactory.CreateParamDef(L"omax",CValue::siDouble,siPersistable | siAnimatable,L"",L"",1,0,1,0,1);
   op.AddParameter(pdef,param);
   pdef = oFactory.CreateParamDef(L"soft_blend",CValue::siDouble,siPersistable | siAnimatable,L"",L"",.5,0,1,0,1);
   op.AddParameter(pdef,param);
   pdef = oFactory.CreateParamDef(L"upv_mode",CValue::siInt4,siPersistable | siAnimatable,L"",L"",0,0,100000,0,10);
   op.AddParameter(pdef,param);

   op.PutAlwaysEvaluate(false);
   op.PutDebug(0);
   return CStatus::OK;
}
开发者ID:EricTRocks,项目名称:GEAR_mc,代码行数:33,代码来源:sn_null2curve_op.cpp

示例6: init_types_slam2d

  void G2O_ATTRIBUTE_CONSTRUCTOR init_types_slam2d(void)
  {
    Factory* factory = Factory::instance();
    //cerr << "Calling " << __FILE__ << " " << __PRETTY_FUNCTION__ << endl;

    factory->registerType("VERTEX_SE2", new HyperGraphElementCreator<VertexSE2>);
    factory->registerType("VERTEX_XY", new HyperGraphElementCreator<VertexPointXY>);

    factory->registerType("EDGE_PIOR_SE2", new HyperGraphElementCreator<EdgeSE2Prior>);

    factory->registerType("EDGE_SE2", new HyperGraphElementCreator<EdgeSE2>);
    factory->registerType("EDGE_SE2_XY", new HyperGraphElementCreator<EdgeSE2PointXY>);
    factory->registerType("EDGE_BEARING_SE2_XY", new HyperGraphElementCreator<EdgeSE2PointXYBearing>);
    factory->registerType("EDGE_SE2_MULTI", new HyperGraphElementCreator<EdgeSE2Multi>);

    factory->registerType("EDGE_SE2_XY_CALIB", new HyperGraphElementCreator<EdgeSE2PointXYCalib>);

    HyperGraphActionLibrary* actionLib = HyperGraphActionLibrary::instance();

    actionLib->registerAction(new VertexSE2WriteGnuplotAction);
    actionLib->registerAction(new VertexPointXYWriteGnuplotAction);
    actionLib->registerAction(new EdgeSE2WriteGnuplotAction);
    actionLib->registerAction(new EdgeSE2PointXYWriteGnuplotAction);
    actionLib->registerAction(new EdgeSE2PointXYBearingWriteGnuplotAction);

#ifdef G2O_HAVE_OPENGL
    actionLib->registerAction(new VertexSE2DrawAction);
    actionLib->registerAction(new VertexPointXYDrawAction);
    actionLib->registerAction(new EdgeSE2DrawAction);
    actionLib->registerAction(new EdgeSE2PointXYDrawAction);
    actionLib->registerAction(new EdgeSE2PointXYBearingDrawAction);
#endif

  }
开发者ID:AIRLab-POLIMI,项目名称:ROAMFREE,代码行数:34,代码来源:types_slam2d.cpp

示例7: buildup

void ListChecker::buildup (Factory &f, std::string const& templateParameter)
{
	structure = f.get(templateParameter);
	CheckerPtr c = f.get(templateParameter);
	if (!c.get()) throw "Could not create structure of template Parameter";

	// recursive handling code would belong here, but we don't have config
	// at the moment in ListChecker...
	c->buildup(f, "");

	structure = move(c);
}
开发者ID:0003088,项目名称:libelektra-qt-gui-test,代码行数:12,代码来源:checker.cpp

示例8: main

int main()
{
    Factory *fac = new Factory();
    int num;
    for(;;)
    {
        cin >> num;
        
        fac->GetCar(num);
    }
    return 0;
}
开发者ID:DavidL92,项目名称:Try,代码行数:12,代码来源:factory.cpp

示例9: AddGT

  RangeSet AddGT(BasicValueFactory &BV, Factory &F, const llvm::APSInt &V) {
    PrimRangeSet newRanges = F.GetEmptySet();

    for (PrimRangeSet::iterator i = begin(), e = end(); i != e; ++i) {
      if (i->Includes(V) && i->To() > V)
        newRanges = F.Add(newRanges, Range(BV.Add1(V), i->To()));
      else if (i->From() > V)
        newRanges = F.Add(newRanges, *i);
    }
    
    return newRanges;
  }
开发者ID:Killfrra,项目名称:llvm-kernel,代码行数:12,代码来源:RangeConstraintManager.cpp

示例10: construct

        void construct(Factory &the_factory)
        {
            SuperCoder::construct(the_factory);

            m_coefficients_storage.resize(the_factory.max_symbols());
            for(uint32_t i = 0; i < the_factory.max_symbols(); ++i)
            {
                m_coefficients_storage[i].resize(
                    the_factory.max_coefficients_size());
            }

        }
开发者ID:liuleger,项目名称:kodo,代码行数:12,代码来源:coefficient_storage.hpp

示例11: initialize

        void initialize(Factory& the_factory)
        {
            SuperCoder::initialize(the_factory);

            m_offset = the_factory.elimination_offset();

            // The offset and the symbols that we actually plan to decode
            // cannot supersede the maximum symbols which can be stored
            // in the decoder.
            assert(the_factory.elimination_offset() + the_factory.symbols()
                   <= the_factory.max_symbols());
        }
开发者ID:GOPRO1955,项目名称:kodo,代码行数:12,代码来源:elimination_coefficient_offset.hpp

示例12: get

Layer* Layer::GetLayer(Vertex* data, string position)
{
    if(!data)
        return NULL;

    Vertex* field = get(LAYOUT, ANY)->get(FIELD, position);
    if(!field)
        return NULL;
    Vertex* req = field->Vertex::get(REQUEST)->get();

    FactoryMap* layer_factories = dynamic_cast<FactoryMap*>(get(FACTORYMAP, LAYER_FACTORIES));
    Factory* factory = NULL;

    // Get the Layer and basic Layout type
    if(req->get()->name() == ANY)
    {
        factory = layer_factories->GetFactory(data);
        if(!factory)
            factory = dynamic_cast<Factory*>(layer_factories->get(FACTORY, ANY));
        req = req->get(factory->get(OUTPUTTYPE)->get()->name());
    }
    else if(req->size() > 1)
    {
        Vertex* tmp_req;
        uint i = 0;
        while((tmp_req=req->get(++i)) != NULL)
        {
            factory = layer_factories->GetFactory(tmp_req->name());
            if(factory && factory->IsValidInput(data))
            {
                req = tmp_req;
                break;
            }
            else
                factory = NULL;
        }
    }

    if(!factory)
    {
        factory = layer_factories->GetFactory(req->get()->name());
        if(!factory)
            return NULL;
    }

    // Create the Layer
    factory->execute(data);
    Vertex* layer = data->Vertex::get(LAYER, ANY);
    // The position is needed further for layout handling
    layer->name(position);
    return dynamic_cast<Layer*>(layer);
}
开发者ID:astefaniuc,项目名称:Hand,代码行数:52,代码来源:layer.cpp

示例13: main

int main(int argc, char *argv[])
{
    Factory *fac = new ConcreteFactory();
    Product *p = fac->CreateProduct();

    //在ConcreteProduct类中添加一个非接口中的方法,Product类指针肯定不能直接访问。
    //但是可以使用向下类型转换成具体子类ConcreteProduct的指针,,就可以访问ConcreteProduct的所有成员。
    // 但向下类型转换并不总是能够成功,也并不安全。最好还是将接口提取到抽象类Product中.lizheng 20111110 自我理解
    ConcreteProduct *cp = dynamic_cast<ConcreteProduct *>(p);
    cp->test();
    system("pause");
    return 0;
}
开发者ID:Redi0,项目名称:CppLanguagePrograms,代码行数:13,代码来源:testFactoryMethod.cpp

示例14: Factory

Vrui::ToolFactory* LayerToggleTool::init()
{
  Factory* factory = new Factory(
    "CrustaLayerToggleTool",
    "Layer Visibility Toggler",
    dynamic_cast<Vrui::ToolFactory*>(Vrui::getToolManager()->loadClass("CrustaTool")),
    *Vrui::getToolManager());
  factory->setNumButtons(1);
  factory->setButtonFunction(0, "Toggle layer visibility");
  Vrui::getToolManager()->addClass(factory, Vrui::ToolManager::defaultToolFactoryDestructor);
  LayerToggleTool::factory = factory;
  return factory;
}
开发者ID:KeckCAVES,项目名称:crusta,代码行数:13,代码来源:LayerToggleTool.cpp

示例15: main

// 1)为了提高内聚(Cohesion)和松耦合(Coupling) ,我们经常会抽象出一些类的公共接口以形成抽象基类或者接口。
//    这样我们可以通过声明一个指向基类的指针来指向实际的子类实现,达到了多态的目的。
//    这里很容易出现的一个问题 n 多的子类继承自抽象基类,我们不得不在每次要用到子类的地方就编写诸如 new  ×××;的代码。
//    这里带来两个问题 
//		1)客户程序员必须知道实际子类的名称(当系统复杂后,命名将是一个很不好处理的问题,为了处理可能的名字冲突,
//		   有的命名可能并不是具有很好的可读性和可记忆性,就姑且不论不同程序员千奇百怪的个人偏好了。 ) ,
//		2)程序的扩展性和维护变得越来越困难。 
// 2)还有一种情况就是在父类中并不知道具体要实例化哪一个具体的子类。
//	  这里的意思为:假设我们在类 A 中要使用到类 B,B 是一个抽象父类,在 A 中并不知道具体要实例化那一个 B 的子类,但是在类 A的子类 D中是可以知道的。
//	  在 A中我们没有办法直接使用类似于 new  ×××的语句,因为根本就不知道×××是什么。 
//	  
int main(int argc, char* argv[])
{
	Factory* fac = new ConcreteFactory1();  //这不是new了子类吗? 工厂
 
	Product* p = fac->CreateProduct(); //创建产品  不需要指明具体产品了

	Factory* fac2 = new ConcreteFactory2();  //这不是new了子类吗? 工厂

	Product* p2 = fac2->CreateProduct(); //创建产品  不需要指明具体产品了

	printf("Hello World!\n");
	return 0;
}
开发者ID:ircc,项目名称:test-code-backup,代码行数:24,代码来源:Factory_exam.cpp


注:本文中的Factory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。