windows-nt/Source/XPSP1/NT/termsrv/remdsk/rds/t120/h/randchnl.h

122 lines
2.9 KiB
C
Raw Normal View History

2020-09-26 03:20:57 -05:00
/*
* randchnl.h
*
* Copyright (c) 1995 by DataBeam Corporation, Lexington, KY
*
* Abstract:
* This is the interface file for the RandomChannelGenerator class. This
* class inherits from the RandomNumberGenerator class. On instantiation,
* instances of this class will internally generate a random number which
* falls within the allowable range of dynamic channel values. Channel
* assignments are then generated by incrementing this value each time a
* new assignment is requested. Once the maximum allowable value has been
* assigned, the next value to be generated "wraps around" to the minimum
* allowable value.
*
* Obviously, this class does not generate completely random channel
* values for each request. With a completely random generator, it is
* possible to delete a channel in MCS, and then have the random number
* generator assign the same value as the deleted channel before all
* components of the system even know that the channel was deleted to
* start with, thus causing erratic behavior in the system. In this
* class, no channel can be reassigned until all other possible channels
* have been assigned.
*
* This class can be modifed in the future to incorporate additional
* "randomness" into the algorithm and still not reassign any channel
* numbers before all other possible values are used. This, however,
* would be at the expense of performance and/or memory resources.
*
* Caveats:
* None.
*
* Author:
* Alan D. May
*/
#ifndef _RANDOM_CHANNEL_GENERATOR_
#define _RANDOM_CHANNEL_GENERATOR_
#include "databeam.h"
#include "random.h"
/*
* The definition of the RandomChannelGenerator class.
*/
class RandomChannelGenerator
{
public:
RandomChannelGenerator ();
virtual ~RandomChannelGenerator ();
RandomValue GetRandomChannel ();
private:
ULong Current_Channel;
};
typedef RandomChannelGenerator * PRandomChannelGenerator;
/*
* RandomChannelGenerator ()
*
* Functional Description:
* The constructor creates a random channel generator object by calling the
* constructor for the parent class, RandomNumberGenerator. This then
* automatically seeds the random number generator with the current time.
* The default algorithm will be used.
*
* Formal Parameters:
* None.
*
* Return Value:
* None.
*
* Side Effects:
* None.
*
* Caveats:
* None.
*/
/*
* ~RandomChannelGenerator ()
*
* Public
*
* Functional Description:
* This is the destructor for the RandomChannelGenerator class.
*
* Formal Parameters:
* None.
*
* Return Value:
* None.
*
* Side Effects:
* None.
*
* Caveats:
* None.
*/
/*
* RandomValue GetRandomChannel ()
*
* Public
*
* Functional Description:
* This method returns a valid dynamic channel number.
*
* Formal Parameters:
* None.
*
* Return Value:
* A RandomValue in the range of valid dynamic channel values.
*
* Side Effects:
* None.
*
* Caveats:
* None.
*/
#endif