本文整理汇总了C++中Synchronised::getData方法的典型用法代码示例。如果您正苦于以下问题:C++ Synchronised::getData方法的具体用法?C++ Synchronised::getData怎么用?C++ Synchronised::getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Synchronised
的用法示例。
在下文中一共展示了Synchronised::getData方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
/** Update function called from the GUIEngine to handle displaying of the
* messages. It will make sure that each message is shown for a certain
* amount of time, before it is discarded and the next message (if any)
* is displayed.
* \param dt Time step size.
*/
void update(float dt)
{
g_all_messages.lock();
bool empty = g_all_messages.getData().empty();
g_all_messages.unlock();
if (empty) return;
g_all_messages.lock();
g_current_display_time += dt;
if (g_current_display_time > g_max_display_time)
{
Message *last = g_all_messages.getData().top();
g_all_messages.getData().pop();
delete last;
if (g_all_messages.getData().empty())
{
g_all_messages.unlock();
return;
}
g_current_display_time = -1.0f;
}
Message *current = g_all_messages.getData().top();
// Create new data for the display.
if (g_current_display_time < 0)
{
createLabel(current);
}
g_all_messages.unlock();
GUIEngine::getSkin()->drawMessage(g_container, g_area,
current->getRenderType());
current->draw();
} // update
示例2: add
/** Adds a message to the message queue.
* \param mt The MessageType of the message.
* \param message The actual message.
*/
void add(MessageType mt, const irr::core::stringw &message)
{
Message *m = new Message(mt, message);
g_all_messages.lock();
if (g_all_messages.getData().empty())
{
// Indicate that there is a new message, which should
// which needs a new label etc. to be computed.
g_current_display_time =-1.0f;
}
g_all_messages.getData().push(m);
g_all_messages.unlock();
} // add
示例3: updatePosition
/** Called when the screen resolution is changed to compute the new
* position of the message. */
void updatePosition()
{
g_all_messages.lock();
bool empty = g_all_messages.getData().empty();
if (empty)
{
g_all_messages.unlock();
return;
}
Message *last = g_all_messages.getData().top();
createLabel(last);
g_all_messages.unlock();
} // updatePosition
示例4: getMyAddress
/** Returns the IP address of this host. We need to return a copy
* to make sure the address is thread safe (otherwise it could happen
* that e.g. data is taken when the IP address was written, but not
* yet the port). */
const TransportAddress getMyAddress() const
{
TransportAddress a;
m_my_address.lock();
a.copy(m_my_address.getData());
m_my_address.unlock();
return a;
} // getMyAddress
示例5: getAddon
/** Returns the i-th addons. */
const Addon& getAddon(unsigned int i) { return m_addons_list.getData()[i];}
示例6: getNumAddons
/** Returns the list of addons (installed and uninstalled). */
unsigned int getNumAddons() const { return m_addons_list.getData().size();}