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


C++ Root类代码示例

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


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

示例1: main

int main(int argc, char* argv[])
{
    if (argc < 3) {
        print_error(ERROR_FEW_ARGS);
        return ERROR_FEW_ARGS;
    }
    std::string rootpath = argv[1];
    std::string dirpath = argv[2];

    std::vector<std::string> vpath;
    size_t pathResult = get_path(dirpath, vpath);
    if ((pathResult != SUCCESS) || (vpath.size() < 1)) {
        print_error(pathResult);
        return pathResult;
    }

    Root* root = new Root(rootpath);
    Bitmap* bitmap = new Bitmap(root);

    if (root->get_freeBlocksCount() < 1) {
        print_error(ERROR_NOT_ENOUGH_SPACE);
        return ERROR_NOT_ENOUGH_SPACE;
    }
    Dir* rootDir = root->get_rootDir();
    rootDir->readSelf(root);

    size_t result = create_dirpath(bitmap, rootDir, vpath.begin(), vpath.end());
    if (result != SUCCESS) {
        print_error(result);
        return result;
    }
    SaveFS(root, bitmap, rootDir);

    return SUCCESS;
}
开发者ID:e-learning,项目名称:aptu-os,代码行数:35,代码来源:mkdir.cpp

示例2: startup

	int startup()
	{
		_root = new Root("plugins_d.cfg");
		
		if (!_root->showConfigDialog()) {
			return -1;
		}

		RenderWindow* window = _root->initialise(true, "Lab 4");
		_sceneManager = _root->createSceneManager(ST_GENERIC);

		Camera* camera = _sceneManager->createCamera("Camera");
		camera->setPosition(Ogre::Vector3(0,0,50));
		camera->lookAt(Ogre::Vector3(0,0,0));
		camera->setNearClipDistance(5);

		Viewport *viewPort = window->addViewport(camera);
		viewPort->setBackgroundColour(ColourValue(0.0,0.0,0.0));

		camera->setAspectRatio(Real(viewPort->getActualWidth())/Real(viewPort->getActualHeight()));

		loadResources(); 
		createScene();

		_listener = new MyFrameListener(window, camera, new CylindricalEffect(_myCube, Ogre::Vector3(2.0, 10.0, 0.0), Ogre::Vector3(0.0, 0.0, 0.1)));
		_root->addFrameListener(_listener);
		return 0;
	}
开发者ID:bjerkins,项目名称:GEDE2014,代码行数:28,代码来源:MyApplication.cpp

示例3: assert

template <class R, class N, class K, int n> inline void TreeInNode<R, N, K, n>::check() const {
	N const* me = static_cast<N const*>(this);
	if (root_) {
		Root* myroot = root_;
		if (parent_ == 0) {
			assert(static_cast<Root*>(root_)->base_ == me);
		} else {
			Node* myparent = static_cast<Node*>(parent_);
			assert(myparent->left_ == me || myparent->right_ == me);
			assert(myparent->root_ == root_);
		}

		if (left_) {
			Node* myleft = static_cast<Node*>(left_);
			assert(myleft->parent_ == me);
			assert(myroot->compare(*me, *left_) <= 0);
			assert(myroot->compare(*left_, *me) >= 0);
		}

		if (right_) {
			Node* myright = static_cast<Node*>(right_);
			assert(myright->parent_ == me);
			assert(myroot->compare(*me, *right_) >= 0);
			assert(myroot->compare(*right_, *me) <= 0);
		}
	} else {
		assert(parent_ == 0);
		assert(left_ == 0);
		assert(right_ == 0);
	}
}
开发者ID:richard-damon,项目名称:containers,代码行数:31,代码来源:TreeIn.hpp

示例4: TEST

TEST(MouseControllerUnitTest, CheckConstructor)
{
    Root * root = new Root;
    MouseController mc(root);
    EXPECT_EQ(root, mc.root_);
    root->release();
}
开发者ID:bonescreater,项目名称:bones,代码行数:7,代码来源:mouse_controller_unittest.cpp

示例5: assert

void Inheritancetest::test_flush()
{
    Inheritance & i = Inheritance::instance();

    i.flush();

    // Make sure the type for root can no longer be retrieved
    const TypeNode * no_root_node = i.getType("root");
    assert(no_root_node == 0);
    const Root & non_root = i.getClass("root");
    assert(i.getAllObjects().empty());
    assert(!non_root.isValid());

    // Make sure installing a child of root now fails.
    Root r;
    r->setId("squigglymuff");
    r->setParents(std::list<std::string>(1, "root"));
    assert(i.addChild(r) == 0);

    assert(!i.hasClass("root"));
    assert(!i.hasClass("root_entity"));
    assert(!i.hasClass("root_operation"));
    assert(!i.hasClass("login"));
    assert(!i.hasClass("squigglymuff"));
}
开发者ID:9cat,项目名称:cyphesis,代码行数:25,代码来源:Inheritancetest.cpp

示例6: addTypeToList

static void addTypeToList(const Root & type, ListType & typeList)
{
    typeList.push_back(type->getId());
    Element children;
    if (type->copyAttr("children", children) != 0) {
        return;
    }
    if (!children.isList()) {
        log(ERROR, compose("Type %1 children attribute has type %2 instead of "
                           "string.", type->getId(),
                           Element::typeName(children.getType())));
        return;
    }
    ListType::const_iterator I = children.List().begin();
    ListType::const_iterator Iend = children.List().end();
    for (; I != Iend; ++I) {
        Root child = Inheritance::instance().getClass(I->asString());
        if (!child.isValid()) {
            log(ERROR, compose("Unable to find %1 in inheritance table",
                               I->asString()));
            continue;
        }
        addTypeToList(child, typeList);
    }
}
开发者ID:mrceresa,项目名称:cyphesis,代码行数:25,代码来源:Admin.cpp

示例7: error

void Admin::createObject(const std::string & type_str,
                           const Root & arg,
                           const Operation & op,
                           OpVector & res)
{
    const std::string & objtype = arg->getObjtype();
    if (objtype == "class" || objtype == "op_definition") {
        // New entity type
        if (!arg->hasAttrFlag(Atlas::Objects::ID_FLAG)) {
            error(op, "Set arg has no id.", res, getId());
            return;
        }
        const std::string & id = arg->getId();

        if (Inheritance::instance().hasClass(id)) {
            error(op, "Attempt to install type that already exists", res,
                  getId());
            return;
        }
        const Root & o = Inheritance::instance().getClass(type_str);
        if (!o.isValid()) {
            error(op, compose("Attempt to install type with non-existant "
                              "parent \"%1\"", type_str), res, getId());
            return;
        }
        if (Ruleset::instance()->installRule(id, "unknown", arg) == 0) {
            Info info;
            info->setTo(getId());
            info->setArgs1(arg);
            res.push_back(info);
        } else {
            error(op, "Installing new type failed", res, getId());
        }
    } else if (type_str == "juncture") {
        std::string junc_id;
        long junc_iid = newId(junc_id);
        if (junc_iid < 0) {
            error(op, "Juncture failed as no ID available", res, getId());
            return;
        }

        Juncture * j = new Juncture(m_connection, junc_id, junc_iid);

        m_connection->addObject(j);
        m_connection->m_server.addObject(j);

        Anonymous info_arg;
        j->addToEntity(info_arg);

        Info info;
        info->setTo(getId());
        info->setArgs1(info_arg);
        if (!op->isDefaultSerialno()) {
            info->setRefno(op->getSerialno());
        }
        res.push_back(info);
    } else {
        Account::createObject(type_str, arg, op, res);
    }
}
开发者ID:mrceresa,项目名称:cyphesis,代码行数:60,代码来源:Admin.cpp

示例8: while

  void MarkSweepGC::collect(Roots &roots, CallFrameLocationList& call_frames) {
    Object* tmp;

    Root* root = static_cast<Root*>(roots.head());
    while(root) {
      tmp = root->get();
      if(tmp->reference_p()) {
        saw_object(tmp);
      }

      root = static_cast<Root*>(root->next());
    }

    // Walk all the call frames
    for(CallFrameLocationList::const_iterator i = call_frames.begin();
        i != call_frames.end();
        ++i) {
      CallFrame** loc = *i;
      walk_call_frame(*loc);
    }

    while(!mark_stack_.empty()) {
      tmp = mark_stack_.back();
      mark_stack_.pop_back();
      scan_object(tmp);
    }

    after_marked();
  }
开发者ID:Twisol,项目名称:rubinius,代码行数:29,代码来源:marksweep.cpp

示例9: tryToConnect

static int tryToConnect(PossessionClient& possessionClient)
{
    if (possessionClient.connectLocal(client_socket_name) == 0) {
        log(INFO, String::compose("Connected to server at %1.", client_socket_name));
        Root systemAccountResponse = possessionClient.createSystemAccount();
        if (!systemAccountResponse.isValid()) {
            return -2;
        }

        if (!systemAccountResponse->hasAttrFlag(Atlas::Objects::ID_FLAG)) {
            std::cerr << "ERROR: Logged in, but account has no id" << std::endl << std::flush;
        } else {

            int rulesCounter = 0;
            log(INFO, "Requesting rules from server");
            std::function<bool(const Atlas::Objects::Root&)> inheritenceFn = [&](const Atlas::Objects::Root& root) -> bool{
                Inheritance::instance().addChild(root);
                rulesCounter++;
                return true;
            };

            possessionClient.runTask(new RuleTraversalTask(systemAccountResponse->getId(), inheritenceFn), "game_entity");
            possessionClient.pollUntilTaskComplete();
            log(INFO, String::compose("Completed receiving %1 rules from server", rulesCounter));

            possessionClient.createAccount(systemAccountResponse->getId());
        }
        return 0;
    } else {
        return -1;
    }
}
开发者ID:olekw,项目名称:cyphesis,代码行数:32,代码来源:aiclient.cpp

示例10: createRenderWindow

    void createRenderWindow()
    {
		mRoot->initialise(false);

		{
			Ogre::String lWindowTitle = "Ballz";

			Ogre::ConfigFile cfgFile;
			cfgFile.loadDirect("config.ini");
			std::string wString = cfgFile.getSetting("width", "renderer");
			std::string hString = cfgFile.getSetting("height", "renderer");
			std::string fsString = cfgFile.getSetting("fullscreen", "renderer");
			int lSizeX = Ogre::StringConverter::parseInt(wString);
			int lSizeY = Ogre::StringConverter::parseInt(hString);
			int lFullscreen = Ogre::StringConverter::parseBool(fsString);

			Ogre::NameValuePairList lParams;
			// we use our own FXAA
			lParams["FSAA"] = "0"; 
			lParams["vsync"] = "false";

			lParams["useNVPerfHUD"] = "true";

			mWindow = mRoot->createRenderWindow(lWindowTitle, lSizeX, lSizeY, lFullscreen, &lParams);
		}	
    }
开发者ID:RazielXT,项目名称:Autumn-Ashes---legacy-code,代码行数:26,代码来源:AAmain.cpp

示例11: setupRenderSystem

 void setupRenderSystem()
 {
    if (!mRoot->restoreConfig() && !mRoot->showConfigDialog()) {
       throw Exception(52, "User canceled the config dialog!",
          "Application::setupRenderSystem()");
    }
 }
开发者ID:sesc4mt,项目名称:mvcdecoder,代码行数:7,代码来源:ex_ogre3d.cpp

示例12: Root

void Game::startup(int width,int height,float scale)
{
	Root* root  = new Root("./main.cfg", "root.log");
	GLRenderSystem* render = new GLRenderSystem();
	root->setRender(render);
	

}
开发者ID:reedhong,项目名称:lotus,代码行数:8,代码来源:Game.cpp

示例13:

WINTERMOON_BEGIN_NAMESPACE

EventListener::EventListener()
{
	Root* root = Root::instance();
	InputManager* input = root->inputManager();
	input->addListener(this);
}
开发者ID:skhaz,项目名称:wintermoon,代码行数:8,代码来源:EventListener.cpp

示例14: setupRenderSystem

    void setupRenderSystem()
    {

		const Ogre::RenderSystemList& lRenderSystemList = mRoot->getAvailableRenderers();
			Ogre::RenderSystem *lRenderSystem = lRenderSystemList[0];

			mRoot->setRenderSystem(lRenderSystem);
    }
开发者ID:RazielXT,项目名称:Autumn-Ashes---legacy-code,代码行数:8,代码来源:AAmain.cpp

示例15: createFrameListener

    void createFrameListener()
    {
		mListener = new MainListener(mKeyboard, mMouse, mSceneMgr,m_World,mRoot,mWindow);
        mRoot->addFrameListener(mListener);
	    nListener = new NewtonListener(m_World );
		mRoot->addFrameListener(nListener);
	   
    }
开发者ID:RazielXT,项目名称:Autumn-Ashes---legacy-code,代码行数:8,代码来源:AAmain.cpp


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