Class CPLNetworks
Introduction
This class represents the powerline networks detected on a given host Ethernet interface. It is implemented as a collection of CPLNetwork objects each of which is a collection of CPLStation objects. It defines the complete powerline network topology for the interface in one object instance.
This class is declared in CPLNetworks.hpp and defined in CPLNetworks.cpp.
Inheritance
None.
Dependence
This class uses class CPLChannel to identifiy the host interface, detected connected bridges and exchange messgaes with those bridges.
This class uses class CPLNetwork to represent detected powerline networks.
Properties
CPLNetworks::Count
unsigned Countvoid
Return the number of detected networks detected on the host interface. This property does not change over the instance lifetime and is the upper bound when iterating through networks.
CPLNetworks::Empty
bool Emptyvoid
Return logical true if the collection is empty. The collection is empty only if the Count property is 0. An empty collection may indicate that the class was instantiated with an incorrect channel PeerAddress.
CPLNetworks::End
bool Endvoid
Return logical true if the collection is exhausted. The collection is exhausted if the Index property equals or exceeds the Count property.
CPLNetworks::Index
unsigned Indexvoid
Return the index of the selected interface. The index ranges from 0 up to (but excluding) the value the Count property. Class methods and operators may be used to alter the value of this property.
CPLNetworks::Network
CPLNetwork & Networkvoid
Return the selected CPLNetwork object instance. This property is the same as the Selected property.
CPLNetworks::Selected
CPLNetwork & Selectedvoid
Return the selected CPLNetwork object instance. The selected instance is determined by the Index property. All CPLNetwork class constants, properties, methods and operators are available to the application through this instance.
Methods
CPLNetworks::Enumerate
CPLNetworks & Enumeratevoid
Enumerate detected networks on stdout. This is equivalent to calling the Preface method then calling the Enumerate method for each network in the collection.
CPLNetworks::Select
CPLNetworks & Selectunsigned index
Select a station by index. This sets the Index property and determines the station that will be returned by the Selected and Network properties.
CPLNetworks::SelectFirst
CPLNetworks & SelectFirstvoid
Set the Index property to 0.
CPLNetworks::SelectFinal
CPLNetworks & SelectFinalvoid
Set the Index property to one less than the Count property.
CPLNetworks::SelectNext
CPLNetworks & SelectNextvoid
Increment the Index property if it is less than the Count property.
CPLNetworks::SelectPrev
CPLNetworks & SelectPrevvoid
Decrement the Index property if it is greater than 0.
Operators
CPLNetworks::operator []
CPLNetwork & operator []unsigned index
Select a network station and return an instance of it. This operator has the same effect as calling the Select method with index then reading either the Selected or the Network property.
CPLNetworks::operator =
CPLNetworks & operator =unsigned index
Select a network station by network index. This operator has the same effect as the Select method with index.
Constructors
CPLNetworkschar const * ifname
Instantiate a collection of powerline networks on the named host interface. The interface name, ifname, can be obtained from any ointerface object or from any operating system function designed for that purpose.
Examples
The following example enumerates all stations on all networks on all host interfaces.
Enumerate All Powerline Networks on all Interface
ointerfaces interfaces;
while (!interfaces.End ())
{
CPLNetworks * networks = new CPLNetworks (interfaces.Interface ().Name ());
networks->Enumerate ();
while (!networks->End ())
{
networks->Selected ().Enumerate ();
networks->SelectNext ();
}
delete networks;
interfaces.SelectNext ();
}
Each interface name is used to instantiate a new networks which is enumerated in two ways. The networks Enumerate methods is used first then each network is enumerated individually.