SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWFunctorList0 Class Reference

Deprecated. A sequence of functors whose invocation takes no arguments. More...

#include <rw/functor/list/RWFunctorList0.h>

Inheritance diagram for RWFunctorList0:
RWFunctor0

Public Member Functions

 RWFunctorList0 (const RWFunctorList0 &second)
 
 RWFunctorList0 (void)
 
 ~RWFunctorList0 (void)
 
void add (const RWFunctor0 &functor, RWCallbackScope scope)
 
void operator() (void) const
 
RWFunctorList0operator= (const RWFunctorList0 &second)
 
void remove (const RWFunctor0 &functor)
 
void update (void)
 
- Public Member Functions inherited from RWFunctor0
 RWFunctor0 (const RWFunctor0 &second)
 
 RWFunctor0 (const RWTFunctor< void()> &second)
 
 RWFunctor0 (RWFunctor0Imp *functorImp)
 
 RWFunctor0 (RWStaticCtor)
 
 RWFunctor0 (void)
 
 ~RWFunctor0 (void)
 
RWFunctor0Impbody (void) const
 
RWFunctor0operator= (const RWFunctor0 &second)
 
RWFunctor0operator= (const RWTFunctor< void()> &second)
 

Additional Inherited Members

- Public Types inherited from RWFunctor0
typedef void(* CallerSignature) (void)
 

Detailed Description

Deprecated
As of SourcePro 12.5, use RWTValSlist<RWTFunctor<void()>> instead.

The RWFunctorList0 class is a sequence of functors whose invocation takes no arguments.

A function object, or a functor, encapsulates a call to an associated function. When a functor is invoked, it calls the associated function.

A functor list is a sequence of such functors. The list's invocation results in the invocation of all functors contained in the list. This is useful when you wish to connect more that one invocation to a particular action.

Example
#include <rw/functor/list/RWFunctorList0.h>
#include <rw/functor/functor0.h>
#include <iostream>
void foo(int x) {
std::cout << "foo was called with " << x << std::endl;
}
void bar() { std::cout << "bar was called" << std::endl; }
int main() {
// create new functors
RWFunctor0 fooFunctor = rwtMakeFunctor0(0, foo, 4);
RWFunctor0 barFunctor = rwtMakeFunctor0(0, bar);
// create a new functor list
// add the functors to the list
flist.add(fooFunctor, RW_CALL_REPEATEDLY);
flist.add(barFunctor, RW_CALL_REPEATEDLY);
// invoke the list and see that both the functors are called
flist();
return 0;
}
Deprecated. Represents the group of functors that are invoked without any arguments and whose invocat...
Definition RWFunctor0.h:94
Deprecated. A sequence of functors whose invocation takes no arguments.
Definition RWFunctorList0.h:88
void add(const RWFunctor0 &functor, RWCallbackScope scope)
RWFunctor0 rwtMakeFunctor0(void(*caller)(void), DR(*callee)(void))
Definition rwtMakeFunctor0.h:83
@ RW_CALL_REPEATEDLY
Definition RWCallbackScope.h:51

OUTPUT:

foo was called with 4
bar was called

Constructor & Destructor Documentation

◆ RWFunctorList0() [1/2]

RWFunctorList0::RWFunctorList0 ( void )

Constructs an empty list instance.

◆ RWFunctorList0() [2/2]

RWFunctorList0::RWFunctorList0 ( const RWFunctorList0 & second)

Copy constructor. Creates a new list instance that shares its list representation with second.

◆ ~RWFunctorList0()

RWFunctorList0::~RWFunctorList0 ( void )

Destructor.

Member Function Documentation

◆ add()

void RWFunctorList0::add ( const RWFunctor0 & functor,
RWCallbackScope scope )

Adds the specified functor to the list. Duplicates are allowed in the list. In such cases the functor is run once for each time it appears in the list.

The add request is stored until either the list is invoked, or the update() method is called.

◆ operator()()

void RWFunctorList0::operator() ( void ) const

Invokes the functor list. This includes updating the list with any stored adds or removes, invoking each functor in the list, and removing any functors that were added with the RW_CALL_ONCE flag.

Exceptions
RWTHRInternalErrorThrown if more than one thread attempts to invoke the list at a time.

◆ operator=()

RWFunctorList0 & RWFunctorList0::operator= ( const RWFunctorList0 & second)

Assignment operator. Binds this list instance to representation of list second.

◆ remove()

void RWFunctorList0::remove ( const RWFunctor0 & functor)

Removes all entries from the list that contain the specified functor.

The remove request is stored until either the list is invoked, or the update() method is called.

◆ update()

void RWFunctorList0::update ( void )

Updates the list with any add() or remove() requests that have occurred since the last invocation.

Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.