本文整理汇总了C++中Universe类的典型用法代码示例。如果您正苦于以下问题:C++ Universe类的具体用法?C++ Universe怎么用?C++ Universe使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Universe类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: getSelectionName
// Utility function that returns the complete path for a selection.
string
getSelectionName(const Selection& selection, CelestiaCore* appCore)
{
Universe *universe = appCore->getSimulation()->getUniverse();
switch (selection.getType())
{
case Selection::Type_Body:
return getBodyName(universe, selection.body());
case Selection::Type_Star:
return universe->getStarCatalog()->getStarName(*selection.star());
case Selection::Type_DeepSky:
return universe->getDSOCatalog()->getDSOName(selection.deepsky());
case Selection::Type_Location:
{
std::string name = selection.location()->getName();
Body* parentBody = selection.location()->getParentBody();
if (parentBody != NULL)
name = getBodyName(universe, parentBody) + ":" + name;
return name;
}
default:
return "";
}
}
开发者ID:sanyaade-embedded-systems,项目名称:STA,代码行数:30,代码来源:url.cpp
示例2: store
/*
* Check the SetMergeMode method works
*/
void OlaServerServiceImplTest::testSetMergeMode() {
UniverseStore store(NULL, NULL);
OlaServerServiceImpl impl(&store,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
m_uid);
OlaClientService service(NULL, &impl);
unsigned int universe_id = 0;
GenericAckCheck<SetMergeModeCheck> ack_check;
GenericMissingUniverseCheck<SetMergeModeCheck, ola::proto::Ack>
missing_universe_check;
// Check we get an error for a missing universe
CallSetMergeMode(&service, universe_id, ola::proto::HTP,
missing_universe_check);
Universe *universe = store.GetUniverse(universe_id);
OLA_ASSERT_FALSE(universe);
// Check SetUniverseName works
universe = store.GetUniverseOrCreate(universe_id);
CallSetMergeMode(&service, universe_id, ola::proto::HTP, ack_check);
OLA_ASSERT(Universe::MERGE_HTP == universe->MergeMode());
// Run it again
CallSetMergeMode(&service, universe_id, ola::proto::LTP, ack_check);
OLA_ASSERT(Universe::MERGE_LTP == universe->MergeMode());
}
开发者ID:mlba-team,项目名称:open-lighting,代码行数:36,代码来源:OlaServerServiceImplTest.cpp
示例3: runner
/*
* Update the DMX values for a particular universe
*/
void OlaServerServiceImpl::UpdateDmxData(
RpcController* controller,
const DmxData* request,
Ack*,
ola::rpc::RpcService::CompletionCallback* done,
Client *client) {
ClosureRunner runner(done);
Universe *universe = m_universe_store->GetUniverse(request->universe());
if (!universe)
return MissingUniverseError(controller);
if (client) {
DmxBuffer buffer;
buffer.Set(request->data());
uint8_t priority = ola::dmx::SOURCE_PRIORITY_DEFAULT;
if (request->has_priority()) {
priority = request->priority();
priority = std::max(static_cast<uint8_t>(ola::dmx::SOURCE_PRIORITY_MIN),
priority);
priority = std::min(static_cast<uint8_t>(ola::dmx::SOURCE_PRIORITY_MAX),
priority);
}
DmxSource source(buffer, *m_wake_up_time, priority);
client->DMXReceived(request->universe(), source);
universe->SourceClientDataChanged(client);
}
}
开发者ID:basileus,项目名称:ola,代码行数:31,代码来源:OlaServerServiceImpl.cpp
示例4: StreamDmxData
/*
* Handle a streaming DMX update, we don't send responses for this
*/
void OlaServerServiceImpl::StreamDmxData(
RpcController*,
const ola::proto::DmxData* request,
ola::proto::STREAMING_NO_RESPONSE*,
ola::rpc::RpcService::CompletionCallback*,
Client *client) {
Universe *universe = m_universe_store->GetUniverse(request->universe());
if (!universe)
return;
if (client) {
DmxBuffer buffer;
buffer.Set(request->data());
uint8_t priority = ola::dmx::SOURCE_PRIORITY_DEFAULT;
if (request->has_priority()) {
priority = request->priority();
priority = std::max(static_cast<uint8_t>(ola::dmx::SOURCE_PRIORITY_MIN),
priority);
priority = std::min(static_cast<uint8_t>(ola::dmx::SOURCE_PRIORITY_MAX),
priority);
}
DmxSource source(buffer, *m_wake_up_time, priority);
client->DMXReceived(request->universe(), source);
universe->SourceClientDataChanged(client);
}
}
开发者ID:basileus,项目名称:ola,代码行数:32,代码来源:OlaServerServiceImpl.cpp
示例5: log_printf
/**
* @brief Clones this Universe and all of the Cells within it and returns it
* @return a pointer to the Universe clone
*/
Universe* Universe::clone() {
log_printf(DEBUG, "Cloning Universe %d", _id);
/* Instantiate new Universe clone */
Universe* clone = new Universe(universe_id());
/* Loop over Cells in Universe and clone each one */
std::map<int, Cell*>::iterator iter1;
for (iter1 = _cells.begin(); iter1 != _cells.end(); ++iter1) {
/* If the Cell is filled with a Material, clone it */
if ((*iter1).second->getType() == MATERIAL) {
/* Clone the Cell */
CellBasic* parent = static_cast<CellBasic*>((*iter1).second);
CellBasic* cell_clone = parent->clone();
/* Add Cell clone to the list */
clone->addCell(cell_clone);
cell_clone->setUniverse(clone->getId());
}
/* Throw error message if Cell is FILL type */
else {
log_printf(ERROR, "Unable to clone Universe %d since it contains Cell %d"
"which is filled with a Universe rather than a Material");
}
}
return clone;
}
开发者ID:AlexYou,项目名称:OpenMOC,代码行数:36,代码来源:Universe.cpp
示例6: test_02
void test_02() {
// Create a universe
Universe universe;
// Add a bunch of objects
Object* A = new Object;
A->set_velocity(0, 1);
for ( int ii = 0; ii < 10; ++ii) {
A->set_position(ii, ii);
universe.add_object(A);
}
std::cout << "Initial conditions: \n";
debug_display_world(universe);
// Iterate the engine a few times
for (int ii = 0; ii < 5; ++ii) {
universe.physics_runtime_iteration();
std::cout << "\nIteration " << ii << ":\n";
debug_display_world(universe);
}
}
开发者ID:zwyber,项目名称:pie,代码行数:25,代码来源:testing.cpp
示例7: StreamDmxData
/*
* Handle a streaming DMX update, we don't send responses for this
*/
void OlaServerServiceImpl::StreamDmxData(
RpcController*,
const ::ola::proto::DmxData* request,
::ola::proto::STREAMING_NO_RESPONSE*,
::google::protobuf::Closure*,
Client *client) {
Universe *universe = m_universe_store->GetUniverse(request->universe());
if (!universe)
return;
if (client) {
DmxBuffer buffer;
buffer.Set(request->data());
uint8_t priority = DmxSource::PRIORITY_DEFAULT;
if (request->has_priority()) {
priority = request->priority();
priority = std::max(DmxSource::PRIORITY_MIN, priority);
priority = std::min(DmxSource::PRIORITY_MAX, priority);
}
DmxSource source(buffer, *m_wake_up_time, priority);
client->DMXRecieved(request->universe(), source);
universe->SourceClientDataChanged(client);
}
}
开发者ID:Siliconsoul,项目名称:ola,代码行数:30,代码来源:OlaServerServiceImpl.cpp
示例8: process
void CommandConstellations::process(ExecutionEnvironment& env)
{
Universe* u = env.getSimulation()->getUniverse();
if (u != NULL)
{
AsterismList* asterisms = u->getAsterisms();
for (AsterismList::const_iterator iter = asterisms->begin();
iter != asterisms->end(); iter++)
{
Asterism* ast = *iter;
if (none)
{
ast->setActive(0);
}
else if (all)
{
ast->setActive(1);
}
else
{
for (int i = 0; i < numConstellations; i++)
{
if (compareIgnoringCase(constellation[i],ast->getName(false)) == 0)
{
ast->setActive(active[i] != 0);
break;
}
}
}
}
}
}
开发者ID:jpcoles,项目名称:ZM,代码行数:32,代码来源:command.cpp
示例9: runner
/*
* Update the DMX values for a particular universe
*/
void OlaServerServiceImpl::UpdateDmxData(
RpcController* controller,
const DmxData* request,
Ack*,
google::protobuf::Closure* done,
Client *client) {
ClosureRunner runner(done);
Universe *universe = m_universe_store->GetUniverse(request->universe());
if (!universe)
return MissingUniverseError(controller);
if (client) {
DmxBuffer buffer;
buffer.Set(request->data());
uint8_t priority = DmxSource::PRIORITY_DEFAULT;
if (request->has_priority()) {
priority = request->priority();
priority = std::max(DmxSource::PRIORITY_MIN, priority);
priority = std::min(DmxSource::PRIORITY_MAX, priority);
}
DmxSource source(buffer, *m_wake_up_time, priority);
client->DMXRecieved(request->universe(), source);
universe->SourceClientDataChanged(client);
}
}
开发者ID:Siliconsoul,项目名称:ola,代码行数:29,代码来源:OlaServerServiceImpl.cpp
示例10: TEST_F
TEST_F(UniverseTest, ObjectsInProximity)
{
const Position CENTER{ 0, 0, 0 };
Universe universe;
auto ship1 = std::make_shared<Common::Game::Object::ShipMock>();
EXPECT_CALL(*ship1, getPosition()).WillOnce(Return(Position(0, 0, 0)));
EXPECT_CALL(*ship1, getId()).Times(AtLeast(1)).WillRepeatedly(Return(1));
universe.add(ship1);
auto ship2 = std::make_shared<Common::Game::Object::ShipMock>();
EXPECT_CALL(*ship2, getPosition()).WillOnce(Return(Position(0, 100, 0)));
EXPECT_CALL(*ship2, getId()).Times(AtLeast(1)).WillRepeatedly(Return(2));
universe.add(ship2);
auto ship3 = std::make_shared<Common::Game::Object::ShipMock>();
EXPECT_CALL(*ship3, getPosition()).WillOnce(Return(Position(0, 1000, 0)));
EXPECT_CALL(*ship3, getId()).Times(AtLeast(1)).WillRepeatedly(Return(3));
universe.add(ship3);
ObjectsVisitorCallbackMock callbackMock;
EXPECT_CALL(callbackMock, call(Ref(*ship1)));
EXPECT_CALL(callbackMock, call(Ref(*ship2)));
universe.objectsInProximity(CENTER, 500, std::ref(callbackMock));
}
开发者ID:podusowski,项目名称:rusted,代码行数:27,代码来源:UniverseTest.cpp
示例11: zeros
void InputOutputMap::setBlackout(bool blackout)
{
/* Don't do blackout twice */
if (m_blackout == blackout)
return;
m_blackout = blackout;
if (blackout == true)
{
QByteArray zeros(512, 0);
for (quint32 i = 0; i < universes(); i++)
{
Universe *universe = m_universeArray.at(i);
if (universe->outputPatch() != NULL)
universe->outputPatch()->dump(universe->id(), zeros);
}
}
else
{
/* Force writing of values back to the plugins */
m_universeChanged = true;
}
emit blackoutChanged(m_blackout);
}
开发者ID:bekiS,项目名称:qlcplus,代码行数:25,代码来源:inputoutputmap.cpp
示例12: OutputPorts
void ArtNetDevice::HandleNodeList(Request *request,
string *response,
RpcController *controller) {
if (!request->has_node_list()) {
controller->SetFailed("Missing NodeListRequest");
return;
}
unsigned int universe_id = request->node_list().universe();
vector<IPV4Address> node_addresses;
vector<OutputPort*> output_ports;
OutputPorts(&output_ports);
vector<OutputPort*>::const_iterator port_iter = output_ports.begin();
for (; port_iter != output_ports.end(); port_iter++) {
Universe *universe = (*port_iter)->GetUniverse();
if (universe && universe->UniverseId() == universe_id) {
m_node->GetSubscribedNodes((*port_iter)->PortId(), &node_addresses);
break;
}
}
ola::plugin::artnet::Reply reply;
reply.set_type(ola::plugin::artnet::Reply::ARTNET_NODE_LIST_REPLY);
ola::plugin::artnet::NodeListReply *node_list_reply =
reply.mutable_node_list();
vector<IPV4Address>::const_iterator iter = node_addresses.begin();
for (; iter != node_addresses.end(); ++iter) {
OutputNode *node = node_list_reply->add_node();
node->set_ip_address(iter->AsInt());
}
reply.SerializeToString(response);
}
开发者ID:Tuckie,项目名称:ola,代码行数:33,代码来源:ArtNetDevice.cpp
示例13: GetUniverse
/*
* Write data to this port.
*/
bool E131OutputPort::WriteDMX(const DmxBuffer &buffer, uint8_t priority) {
Universe *universe = GetUniverse();
if (!universe)
return false;
m_last_priority = (GetPriorityMode() == PRIORITY_MODE_STATIC) ?
GetPriority() : priority;
return m_node->SendDMX(universe->UniverseId(), buffer, m_last_priority,
m_preview_on);
}
开发者ID:DanielAeolusLaude,项目名称:ola,代码行数:13,代码来源:E131Port.cpp
示例14: AnimationSceneImpl
AnimationSceneImpl(IPlugin& anim_system, Engine& engine, Universe& universe, IAllocator& allocator)
: m_universe(universe)
, m_engine(engine)
, m_anim_system(anim_system)
, m_animables(allocator)
{
m_is_game_running = false;
m_render_scene = static_cast<RenderScene*>(universe.getScene(crc32("renderer")));
universe.registerComponentTypeScene(ANIMABLE_TYPE, this);
ASSERT(m_render_scene);
}
开发者ID:xuxiaowei007,项目名称:LumixEngine,代码行数:11,代码来源:animation_system.cpp
示例15: if
/**
* @brief Finds the Cell for which a LocalCoords object resides.
* @details Finds the Cell that a LocalCoords object is located inside by
* checking each of this Universe's Cells. Returns NULL if the
* LocalCoords is not in any of the Cells.
* @param coords a pointer to the LocalCoords of interest
* @param universes a container of all of the Universes passed in by Geometry
* @return a pointer the Cell where the LocalCoords is located
*/
Cell* Universe::findCell(LocalCoords* coords,
std::map<int, Universe*> universes) {
Cell* return_cell = NULL;
std::map<int, Cell*>::iterator iter;
/* Sets the LocalCoord type to UNIV at this level */
coords->setType(UNIV);
/* Loop over all Cells in this Universe */
for (iter = _cells.begin(); iter != _cells.end(); ++iter) {
Cell* cell = iter->second;
if (cell->cellContainsCoords(coords)) {
/* Set the Cell on this level */
coords->setCell(cell->getId());
/* MATERIAL type Cell - lowest level, terminate search for Cell */
if (cell->getType() == MATERIAL) {
coords->setCell(cell->getId());
return_cell = cell;
return return_cell;
}
/* FILL type Cell - Cell contains a Universe at a lower level
* Update coords to next level and continue search */
else if (cell->getType() == FILL) {
LocalCoords* next_coords;
if (coords->getNext() == NULL)
next_coords = new LocalCoords(coords->getX(), coords->getY());
else
next_coords = coords->getNext();
CellFill* cell_fill = static_cast<CellFill*>(cell);
int universe_id = cell_fill->getUniverseFillId();
next_coords->setUniverse(universe_id);
Universe* univ = universes.at(universe_id);
coords->setCell(cell->getId());
coords->setNext(next_coords);
next_coords->setPrev(coords);
if (univ->getType() == SIMPLE)
return univ->findCell(next_coords, universes);
else
return static_cast<Lattice*>(univ)->findCell(next_coords, universes);
}
}
}
return return_cell;
}
开发者ID:AlexYou,项目名称:OpenMOC,代码行数:63,代码来源:Universe.cpp
示例16: locker
void InputOutputMap::flushInputs()
{
QMutexLocker locker(&m_universeMutex);
for (int i = 0; i < m_universeArray.count(); i++)
{
Universe *universe = m_universeArray.at(i);
universe->flushInput();
}
}
开发者ID:lachmex,项目名称:qlcplus,代码行数:11,代码来源:inputoutputmap.cpp
示例17: testSetGetDmx
/*
* Check that SetDMX/GetDMX works
*/
void UniverseTest::testSetGetDmx() {
Universe *universe = m_store->GetUniverseOrCreate(TEST_UNIVERSE);
OLA_ASSERT(universe);
// a new universe should be all 0s
DmxBuffer empty_buffer;
OLA_ASSERT(empty_buffer == universe->GetDMX());
// check that SetDMX works
OLA_ASSERT(universe->SetDMX(m_buffer));
OLA_ASSERT(m_buffer == universe->GetDMX());
}
开发者ID:NextGenIntelligence,项目名称:ola,代码行数:15,代码来源:UniverseTest.cpp
示例18: GenericUnPatchPort
bool PortManager::GenericUnPatchPort(PortClass *port) {
if (!port)
return false;
Universe *universe = port->GetUniverse();
m_broker->RemovePort(port);
if (universe) {
universe->RemovePort(port);
port->SetUniverse(NULL);
OLA_INFO << "Unpatched " << port->UniqueId() << " from uni "
<< universe->UniverseId();
}
return true;
}
开发者ID:Jazeido,项目名称:ola,代码行数:14,代码来源:PortManager.cpp
示例19: Category
void taeRuleset::createGame() {
Game* game = Game::getGame();
ObjectManager* obm = game->getObjectManager();
ObjectTypeManager* obtm = game->getObjectTypeManager();
//Create ship design category
Category* cat = new Category();
cat->setName("Ships");
cat->setDescription("Ship components");
game->getDesignStore()->addCategory(cat);
//Create properties
createProperties();
//Create components
createComponents();
//Create resources
setupResources();
uint32_t obT_Universe = obtm->getObjectTypeByName("Universe");
uint32_t obT_Galaxy = obtm->getObjectTypeByName("Galaxy");
//Create the universe
IGObject* universe = obm->createNewObject();
obtm->setupObject(universe, obT_Universe);
Universe* theUniverse = (Universe*)(universe->getObjectBehaviour());
theUniverse->setSize(1000000000000ll);
universe->setName("The Universe");
theUniverse->setPosition(Vector3d(0ll,0ll,0ll));
obm->addObject(universe);
//Create the galaxy
IGObject* gal = obm->createNewObject();
obtm->setupObject(gal, obT_Galaxy);
EmptyObject* galob = (EmptyObject*)(gal->getObjectBehaviour());
galob->setSize(100000000000ll);
gal->setName("The Fertile Galaxy");
galob->setPosition(Vector3d(0ll, -6000ll, 0ll));
gal->addToParent(universe->getID());
obm->addObject(gal);
string path = string(Settings::getSettings()->get("board_path"));
Logger::getLogger()->debug(path.c_str());
createBoard(path, gal->getID());
Logger::getLogger()->info("TaE created");
}
开发者ID:AfrazHussain,项目名称:tpserver-cpp,代码行数:49,代码来源:tae.cpp
示例20: if
void CelestiaAppWindow::slotAddBookmark()
{
// Set the default bookmark title to the name of the current selection
Selection sel = m_appCore->getSimulation()->getSelection();
QString defaultTitle;
if (sel.body() != NULL)
{
defaultTitle = QString::fromUtf8(sel.body()->getName(true).c_str());
}
else if (sel.star() != NULL)
{
Universe* universe = m_appCore->getSimulation()->getUniverse();
defaultTitle = QString::fromUtf8(ReplaceGreekLetterAbbr(universe->getStarCatalog()->getStarName(*sel.star(), true)).c_str());
}
else if (sel.deepsky() != NULL)
{
Universe* universe = m_appCore->getSimulation()->getUniverse();
defaultTitle = QString::fromUtf8(ReplaceGreekLetterAbbr(universe->getDSOCatalog()->getDSOName(sel.deepsky(), true)).c_str());
}
else if (sel.location() != NULL)
{
defaultTitle = sel.location()->getName().c_str();
}
if (defaultTitle.isEmpty())
defaultTitle = _("New bookmark");
CelestiaState appState;
appState.captureState(m_appCore);
// Capture the current frame buffer to use as a bookmark icon.
QImage grabbedImage = glWidget->grabFrameBuffer();
int width = grabbedImage.width();
int height = grabbedImage.height();
// Crop the image to a square.
QImage iconImage;
if (width > height)
iconImage = grabbedImage.copy((width - height) / 2, 0, height, height);
else
iconImage = grabbedImage.copy(0, (height - width) / 2, width, width);
AddBookmarkDialog dialog(m_bookmarkManager, defaultTitle, appState, iconImage);
dialog.exec();
populateBookmarkMenu();
m_bookmarkToolBar->rebuild();
}
开发者ID:nisselarsson,项目名称:Celestia,代码行数:49,代码来源:qtappwin.cpp
注:本文中的Universe类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论