本文整理汇总了C++中list::Item::getNext方法的典型用法代码示例。如果您正苦于以下问题:C++ Item::getNext方法的具体用法?C++ Item::getNext怎么用?C++ Item::getNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类list::Item
的用法示例。
在下文中一共展示了Item::getNext方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: reset
//------------------------------------------------------------------------------
// reset() -- Reset the I/O handler
//------------------------------------------------------------------------------
void IoDevice::reset()
{
BaseClass::reset();
// Reset our I/O adapters
if (adapters != 0) {
List::Item* item = adapters->getFirstItem();
while (item != 0) {
Pair* const pair = (Pair*) item->getValue();
IoAdapter* const p = (IoAdapter*) pair->object();
p->reset();
item = item->getNext();
}
}
// Reset our I/O devices
if (devices != 0) {
List::Item* item = devices->getFirstItem();
while (item != 0) {
Pair* const pair = (Pair*) item->getValue();
IoDevice* const p = (IoDevice*) pair->object();
p->reset();
item = item->getNext();
}
}
}
示例2: setSlotAdapters
// adapters: List of IoAdapter objects
bool IoDevice::setSlotAdapters(PairStream* const list)
{
bool ok = true;
if (list != 0) {
// check to make sure all objects on the list are I/O adapters
unsigned int cnt = 0;
List::Item* item = list->getFirstItem();
while (item != 0) {
cnt++;
Pair* const pair = (Pair*) item->getValue();
ok = pair->object()->isClassType(typeid(IoAdapter));
if (ok) {
((IoAdapter*) pair->object())->container(this);
}
else {
std::cerr << "IoDevice::setSlotAdapters(): Item number " << cnt;
std::cerr << " on the list is a non-IoAdapter component!" << std::endl;
}
item = item->getNext();
}
}
if (ok) adapters = list;
return ok;
}
示例3: updateData
//------------------------------------------------------------------------------
// updateData() -- Update non-time critical (background) stuff here
//------------------------------------------------------------------------------
void Component::updateData(const LCreal dt)
{
// Update all my children
PairStream* subcomponents = getComponents();
if (subcomponents != 0) {
if (selection != 0) {
// When we've selected only one
if (selected != 0) selected->updateData(dt);
}
else {
// When we should update them all
List::Item* item = subcomponents->getFirstItem();
while (item != 0) {
Pair* pair = (Pair*)(item->getValue());
Component* obj = (Component*)( pair->object() );
if (obj != 0) obj->updateData(dt);
item = item->getNext();
}
}
subcomponents->unref();
subcomponents = 0;
}
// Update our log file
if (elog0 != 0) {
elog0->updateData(dt);
}
}
示例4: reset
//------------------------------------------------------------------------------
// reset() -- Reset parameters
//------------------------------------------------------------------------------
void Component::reset()
{
PairStream* subcomponents = getComponents();
if (subcomponents != 0) {
if (selection != 0) {
// When we've selected only one
if (selected != 0) selected->reset();
}
else {
// When we should reset them all
List::Item* item = subcomponents->getFirstItem();
while (item != 0) {
Pair* pair = (Pair*)(item->getValue());
Component* obj = (Component*)( pair->object() );
if (obj != 0) obj->reset();
item = item->getNext();
}
}
subcomponents->unref();
subcomponents = 0;
}
// Reset the log file
if (elog0 != 0) {
elog0->reset();
}
}
示例5: setSlotStateMachines
bool StateMachine::setSlotStateMachines(const PairStream* const msg)
{
// First remove the old list; and make sure we tell the old stMachList
// that we're no longer their container.
if (stMachList != nullptr) {
List::Item* item = stMachList->getFirstItem();
while (item != nullptr) {
Pair* p = static_cast<Pair*>(item->getValue());
Component* q = static_cast<Component*>(p->object());
q->container(nullptr);
item = item->getNext();
}
stMachList = nullptr;
}
// Build a new list containing only StateMachine class (or derived) objects
if (msg != nullptr) {
PairStream* newList = new PairStream();
// For each object in the list; if it's a StateMachine (or derived from) then
// clone the object and add it to the new list.
const List::Item* item = msg->getFirstItem();
while (item != nullptr) {
const Pair* p = static_cast<const Pair*>(item->getValue());
const StateMachine* q = dynamic_cast<const StateMachine*>(p->object());
if (q != nullptr) {
Pair* cp = static_cast<Pair*>(p->clone());
StateMachine* cq = static_cast<StateMachine*>(cp->object());
cq->container(this);
newList->put(cp);
}
else {
std::cerr << "StateMachine::setSlotStateMachines(): " << *p->slot() << " is not a StateMachine!" << std::endl;
}
item = item->getNext();
}
// Set the pointer to the new stMach list
stMachList = newList;
}
return true;
}
示例6: shutdownNotification
//------------------------------------------------------------------------------
// shutdownNotification() -- Default shutdown
//------------------------------------------------------------------------------
bool Component::shutdownNotification()
{
// Tell all of our components
PairStream* subcomponents = getComponents();
if (subcomponents != nullptr) {
List::Item* item = subcomponents->getFirstItem();
while (item != nullptr) {
const auto pair = static_cast<Pair*>(item->getValue());
const auto p = static_cast<Component*>(pair->object());
p->event(SHUTDOWN_EVENT);
item = item->getNext();
}
subcomponents->unref();
subcomponents = nullptr;
}
shutdown = true;
return shutdown;
}
示例7: shutdownNotification
//------------------------------------------------------------------------------
// shutdownNotification() -- Default shutdown
//------------------------------------------------------------------------------
bool Component::shutdownNotification()
{
// Tell all of our components
PairStream* subcomponents = getComponents();
if (subcomponents != 0) {
List::Item* item = subcomponents->getFirstItem();
while (item != 0) {
Pair* pair = (Pair*)(item->getValue());
Component* p = (Component*) pair->object();
p->event(SHUTDOWN_EVENT);
item = item->getNext();
}
subcomponents->unref();
subcomponents = 0;
}
shutdown = true;
return shutdown;
}
示例8: reset
//------------------------------------------------------------------------------
// reset() -- Reset parameters
//------------------------------------------------------------------------------
void Component::reset()
{
PairStream* subcomponents = getComponents();
if (subcomponents != nullptr) {
if (selection != nullptr) {
// When we've selected only one
if (selected != nullptr) selected->reset();
}
else {
// When we should reset them all
List::Item* item = subcomponents->getFirstItem();
while (item != nullptr) {
const auto pair = static_cast<Pair*>(item->getValue());
const auto obj = static_cast<Component*>(pair->object());
obj->reset();
item = item->getNext();
}
}
subcomponents->unref();
subcomponents = nullptr;
}
}
示例9: updateTC
//------------------------------------------------------------------------------
// updateTC() -- Update time critical stuff here
//------------------------------------------------------------------------------
void Component::updateTC(const double dt)
{
// Update all my children
PairStream* subcomponents = getComponents();
if (subcomponents != nullptr) {
if (selection != nullptr) {
// When we've selected only one
if (selected != nullptr) selected->tcFrame(dt);
}
else {
// When we should update them all
List::Item* item = subcomponents->getFirstItem();
while (item != nullptr) {
const auto pair = static_cast<Pair*>(item->getValue());
const auto obj = static_cast<Component*>( pair->object() );
obj->tcFrame(dt);
item = item->getNext();
}
}
subcomponents->unref();
subcomponents = nullptr;
}
}
示例10: reset
// -----------------------------------------------------------------
// reset() -- Resets the state machine
// -----------------------------------------------------------------
void StateMachine::reset()
{
BaseClass::reset();
// Reset our state machine list
if (stMachList != nullptr) {
List::Item* item = stMachList->getFirstItem();
while (item != nullptr) {
Pair* p = static_cast<Pair*>(item->getValue());
Component* q = static_cast<Component*>(p->object());
q->reset();
item = item->getNext();
}
}
// Goto our RESET state
state = INVALID_STATE;
substate = INVALID_STATE;
stMach = nullptr;
stMachName = nullptr;
arg = nullptr;
goTo(INIT_STATE);
}
示例11: processComponents
//------------------------------------------------------------------------------
// processComponents() -- process our new components list;
// -- Add the components from the input list, 'list', to a new list, 'newList'
// make sure they are all of type Component (or derived from it)
// tell them that we are their container
// -- Add an optional component to the end of the new list
// -- Swap our 'components' list with the new list, newList
// -- Handle selections.
//------------------------------------------------------------------------------
void Component::processComponents(
PairStream* const list,
const std::type_info& filter,
Pair* const add,
Component* const remove
)
{
PairStream* oldList = components.getRefPtr();
// ---
// Our dynamic_cast (see below) already filters on the Component class
// ---
bool skipFilter = false;
if (&filter == 0) skipFilter = true;
else if (filter == typeid(Component)) skipFilter = true;
// ---
// Create a new list, copy (filter) the component pairs and set their container pointers
// ---
PairStream* newList = new PairStream();
if (list != 0) {
// Add the (filtered) components to the new list and set their container
List::Item* item = list->getFirstItem();
while (item != 0) {
Pair* pair = (Pair*) item->getValue();
Component* cp = dynamic_cast<Component*>( pair->object() );
if ( cp != 0 && cp != remove && (skipFilter || cp->isClassType(filter)) ) {
newList->put(pair);
cp->container(this);
}
else if ( cp != 0 && cp == remove ) {
cp->container(0);
}
item = item->getNext();
}
}
// ---
// Add the optional component
// ---
if (add != 0) {
Component* cp = dynamic_cast<Component*>( add->object() );
if ( cp != 0 && (skipFilter || cp->isClassType(filter)) ) {
newList->put(add);
cp->container(this);
}
}
// ---
// Swap lists
// ---
components = newList;
newList->unref();
// ---
// Anything selected?
// ---
if (selection != 0) {
if (selection->isClassType(typeid(String))) {
String str(*((String*)selection));
select(&str);
}
else {
Integer num(((Number*)selection)->getInt());
select(&num);
}
}
if (oldList != 0) {
oldList->unref();
}
}
示例12: processComponents
//------------------------------------------------------------------------------
// processComponents() -- process our new components list;
// -- Add the components from the input list, 'list', to a new list, 'newList'
// make sure they are all of type Component (or derived from it)
// tell them that we are their container
// -- Add an optional component to the end of the new list
// -- Swap our 'components' list with the new list, newList
// -- Handle selections.
//------------------------------------------------------------------------------
void Component::processComponents(
PairStream* const list,
const std::type_info& filter,
Pair* const add,
Component* const remove
)
{
PairStream* oldList = components.getRefPtr();
// ---
// Our dynamic_cast (see below) already filters on the Component class
// ---
bool skipFilter {};
if (filter == typeid(Component)) {
skipFilter = true;
}
// ---
// Create a new list, copy (filter) the component pairs and set their container pointers
// ---
const auto newList = new PairStream();
if (list != nullptr) {
// Add the (filtered) components to the new list and set their container
List::Item* item = list->getFirstItem();
while (item != nullptr) {
const auto pair = static_cast<Pair*>(item->getValue());
const auto cp = dynamic_cast<Component*>( pair->object() );
if ( cp != nullptr && cp != remove && (skipFilter || cp->isClassType(filter)) ) {
newList->put(pair);
cp->container(this);
}
else if ( cp != nullptr && cp == remove ) {
cp->container(nullptr);
}
item = item->getNext();
}
}
// ---
// Add the optional component
// ---
if (add != nullptr) {
const auto cp = dynamic_cast<Component*>( add->object() );
if ( cp != nullptr && (skipFilter || cp->isClassType(filter)) ) {
newList->put(add);
cp->container(this);
}
}
// ---
// Swap lists
// ---
components = newList;
newList->unref();
// ---
// Anything selected?
// ---
if (selection != nullptr) {
if (selection->isClassType(typeid(String))) {
const auto str = new String(*(static_cast<String*>(selection)));
select(str);
str->unref();
}
else {
const auto num = new Integer((static_cast<Number*>(selection))->getInt());
select(num);
num->unref();
}
}
if (oldList != nullptr) {
oldList->unref();
}
}