|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.rbnb.sapi.ChannelMap
public class ChannelMap
A class to encapsulate the concept of a list of channels, each of which contains data.
| Nested Class Summary | |
|---|---|
static class |
ChannelMap.ByteOrderEnum
Byte order enumerated type. |
| Field Summary | |
|---|---|
static ChannelMap.ByteOrderEnum |
LOCAL
The data is in whichever format is appropriate for this NATIVE machine. |
static ChannelMap.ByteOrderEnum |
LSB
Least significant bytes are first in each point, ala Intel. |
static ChannelMap.ByteOrderEnum |
MSB
Most significant bytes are first in each point, as is the case with many UNIX machines, and Java data on export. |
static int |
TYPE_BYTEARRAY
|
static int |
TYPE_FLOAT32
|
static int |
TYPE_FLOAT64
|
static int |
TYPE_INT16
|
static int |
TYPE_INT32
|
static int |
TYPE_INT64
|
static int |
TYPE_INT8
|
static int |
TYPE_STRING
|
static int |
TYPE_UNKNOWN
|
static int |
TYPE_USER
|
| Constructor Summary | |
|---|---|
ChannelMap()
Default constructor. |
|
| Method Summary | |
|---|---|
int |
Add(String channelName)
Adds a channel (or channels, if a wildcard is used) to the acqusition list. |
void |
AddFolder(String channelName)
Add a folder to this channel map. |
void |
AddPlugInOption(String channel,
String key,
String value)
Used in request maps, adds an option to configure a PlugIn's response to this request. |
void |
Clear()
Removes all channels from the acquisition list. |
String[] |
GetChannelList()
Convenience function to return the list of channels contained in this ChannelMap. |
byte[] |
GetData(int index)
Determines the type of the data in the array, and then converts it to an array of bytes in local machine order. |
Object |
GetDataAsArray(int index)
Returns the channel data as an untyped Object. |
byte[][] |
GetDataAsByteArray(int index)
Returns the channel data as an array of arrays of bytes. |
float[] |
GetDataAsFloat32(int index)
Returns the channel data as an array of floats. |
double[] |
GetDataAsFloat64(int index)
Returns the channel data as an array of doubles. |
short[] |
GetDataAsInt16(int index)
Returns the channel data as an array of shorts. |
int[] |
GetDataAsInt32(int index)
Returns the channel data as an array of ints. |
long[] |
GetDataAsInt64(int index)
Returns the channel data as an array of longs. |
byte[] |
GetDataAsInt8(int index)
Returns the channel data as an array of bytes. |
String[] |
GetDataAsString(int index)
Returns the channel data as an array of Strings. |
String[] |
GetFolderList()
Returns the list of empty folders contained within this ChannelMap. |
boolean |
GetIfFetchTimedOut()
Returns true if and only if this channel map was returned in reponse to a Fetch() which timed-out. |
int |
GetIndex(String channelName)
Returns the index of a channel which has been added to this map if given its name. |
String |
GetMime(int index)
Returns the MIME type identifier for this channel, if any. |
String |
GetName(int index)
Get the fully qualified channel name from its index in constant time. |
String[] |
GetNodeList()
Deprecated. Please use the ChannelTree class for
per-node heirarchy construction and identification. |
String[] |
GetPlugInList()
Deprecated. Please use the ChannelTree class for
per-node heirarchy construction and identification. |
String[] |
GetServerList()
Deprecated. Please use the ChannelTree class for
per-node heirarchy construction and identification. |
String[] |
GetSinkList()
Deprecated. Please use the ChannelTree class for
per-node heirarchy construction and identification. |
String[] |
GetSourceList()
Deprecated. Please use the ChannelTree class for
per-node heirarchy construction and identification. |
double |
GetTimeDuration(int index)
Yields the duration of this channel's data. |
double[] |
GetTimes(int index)
Yields the times for each data point for the specified channel. |
double |
GetTimeStart(int index)
Yields the start time of this channel's data. |
int |
GetType(int index)
Returns the type of the data returned by the specified channel. |
String |
GetUserInfo(int channel)
Returns user information for the specified channel, if any is available. |
int |
NumberOfChannels()
Returns the number of channels available in the map. |
void |
PutData(int channelIndex,
byte[] rawData,
int typeID)
Adds the data given in rawBytes to the channel identified with the specified channel index. |
void |
PutData(int channelIndex,
byte[] rawData,
int typeID,
ChannelMap.ByteOrderEnum byteOrder)
Adds the data given in rawBytes to the channel identified with the specified channel index. |
void |
PutDataAsByteArray(int channelIndex,
byte[] data)
Type safe version of PutData(). |
void |
PutDataAsFloat32(int channelIndex,
float[] data)
Type safe version of PutData(). |
void |
PutDataAsFloat64(int channelIndex,
double[] data)
Type safe version of PutData(). |
void |
PutDataAsInt16(int channelIndex,
short[] data)
Type safe version of PutData(). |
void |
PutDataAsInt32(int channelIndex,
int[] data)
Type safe version of PutData(). |
void |
PutDataAsInt64(int channelIndex,
long[] data)
Type safe version of PutData(). |
void |
PutDataAsInt8(int channelIndex,
byte[] data)
Type safe version of PutData(). |
void |
PutDataAsString(int channelIndex,
String data)
Type safe version of PutData(). |
void |
PutDataRef(int destChannel,
ChannelMap sourceMap,
int sourceChannel)
Transfers a reference of the data in the sourceMap to this
map. |
void |
PutMime(int index,
String mime)
Specifies the MIME (Multipurpose Internet Mail Extensions) type of this source data. |
void |
PutTime(double start,
double duration)
Sets the time range for all data subsequently added to the channel map. |
void |
PutTimeAuto(String timeMode)
Sets the mode for automatic time stamp generation that will be used on the next call to Flush(). |
void |
PutTimeRef(ChannelMap sourceMap,
int channelIndex)
Copies the time reference for the specified channel on the ChannelMap provided into the current time buffer for this channel. |
void |
PutTimes(double[] times)
Sets the time vector for all data subsequently added to the channel map. |
void |
PutUserInfo(int channelIndex,
String data)
Specify user information for a given channel. |
int[] |
Search(String mimeType,
String keywords)
Convenience function to search this ChannelMap
for the specified keyword and mimeType. |
String |
toString()
Returns a descriptive String about the state of
this channel map. |
int |
TypeID(String type)
Determines the numerical constant used as the type ID for the specified data type. |
String |
TypeName(int typeID)
Returns a string type identifier which matches the given typeID. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final ChannelMap.ByteOrderEnum LSB
public static final ChannelMap.ByteOrderEnum MSB
public static final ChannelMap.ByteOrderEnum LOCAL
public static final int TYPE_FLOAT64
public static final int TYPE_FLOAT32
public static final int TYPE_INT64
public static final int TYPE_INT32
public static final int TYPE_INT16
public static final int TYPE_INT8
public static final int TYPE_STRING
public static final int TYPE_UNKNOWN
public static final int TYPE_BYTEARRAY
public static final int TYPE_USER
| Constructor Detail |
|---|
public ChannelMap()
| Method Detail |
|---|
public final int Add(String channelName)
throws SAPIException
channelName
must be fully qualified name of the channel, including the
server name.
If the channel is already present, its current index is returned, and no other action is taken.
Note: When making requests of PlugIns,
a double slash should be used when signalling the PlugIn to
forward or filter an absolute channel. For example, use:
SAPIException - If there is a problem parsing the channel name.
NullPointerException - If the channel name is null.
IllegalArgumentException - If the channel name ends in a
slash "/".Clear(),
PutData(int,byte[],int,ChannelMap.ByteOrderEnum)
public final void AddFolder(String channelName)
throws SAPIException
SAPIException - If there is a problem parsing the channel name.
NullPointerException - If the channel name is null.Source.Register(ChannelMap)
public final void AddPlugInOption(String channel,
String key,
String value)
throws SAPIException
For example, if you have a ResamplePlugIn running with the name resample and you want to get a maximum of 1200 points from each channel in the request, you would use:
channelMap.AddPlugInOption("resample", "maxSamples", "1200")
If you wanted to then display a plot of the data through an instance of PNGPlugIn called png, with a width of 640 and a height of 480, you would instead use:
channelMap.AddPlugInOption("png/resample", "maxSamples", "1200")
channelMap.AddPlugInOption("png", "width", "640")
channelMap.AddPlugInOption("png", "height", "480")
channel - The fully qualified channel representing the
PlugIn to configure.key - The case-sensitive name of the option to set.value - The value, a string, of the option to set.
SAPIExceptionpublic final void Clear()
Add(String)public double[] GetTimes(int index)
The array returned is calculated only when this method is first called on the channel index. The same array is returned on successive calls.
A zero length array is returned in cases where no time is available for this channel.
index - The channel index.
ArrayIndexOutOfBoundsException - If index out of bounds.GetData(int)public double GetTimeStart(int index)
Fetch().
index - The channel index.
ArrayIndexOutOfBoundsException - If index out of bounds.GetData(int),
GetTimeDuration(int)public double GetTimeDuration(int index)
Fetch().
index - The channel index.
ArrayIndexOutOfBoundsException - If index out of bounds.GetData(int),
GetTimeStart(int)public byte[] GetData(int index)
index - The channel index.
ArrayIndexOutOfBoundsException - If index out of bounds.GetTimes(int)public double[] GetDataAsFloat64(int index)
index - The channel index.
ArrayIndexOutOfBoundsException - If index out of bounds.
ClassCastException - Channel data is not the correct type.GetData(int)public float[] GetDataAsFloat32(int index)
index - The channel index.
ArrayIndexOutOfBoundsException - If index out of bounds.
ClassCastException - Channel data is not the correct type.GetData(int)public long[] GetDataAsInt64(int index)
index - The channel index.
ArrayIndexOutOfBoundsException - If index out of bounds.
ClassCastException - Channel data is not the correct type.GetData(int)public int[] GetDataAsInt32(int index)
index - The channel index.
ArrayIndexOutOfBoundsException - If index out of bounds.
ClassCastException - Channel data is not the correct type.GetData(int)public short[] GetDataAsInt16(int index)
index - The channel index.
ArrayIndexOutOfBoundsException - If index out of bounds.
ClassCastException - Channel data is not the correct type.GetData(int)public byte[] GetDataAsInt8(int index)
index - The channel index.
ArrayIndexOutOfBoundsException - If index out of bounds.
ClassCastException - Channel data is not the correct type.GetData(int)public String[] GetDataAsString(int index)
index - The channel index.
ArrayIndexOutOfBoundsException - If index out of bounds.
ClassCastException - Channel data is not the correct type.GetData(int)public byte[][] GetDataAsByteArray(int index)
index - The channel index.
ArrayIndexOutOfBoundsException - If index out of bounds.
ClassCastException - Channel data is not the correct type.GetData(int),
GetDataAsInt8(int)public Object GetDataAsArray(int index)
index - The channel index.
ArrayIndexOutOfBoundsException - If index out of bounds.public String GetName(int index)
index - The channel index.
ArrayIndexOutOfBoundsException - If the index is out of bounds.GetIndex(String)public final int GetIndex(String channelName)
Fetch(), even if this map is reused,
and should not be stored.
channelName - The fully qualified channel name, including the server name.
GetName(int)public final int GetType(int index)
index - The desired channel index.
ArrayIndexOutOfBoundsException - If index out of bounds.TYPE_FLOAT64public final String GetMime(int index)
public final boolean GetIfFetchTimedOut()
Fetch() which timed-out.
A call to Sink.Fetch(long) may return a
ChannelMap with no channels. This method allows you to
determine whether this map is empty because the request timed out,
or because the request made matches no data on the server.
public final String GetUserInfo(int channel)
User information corresponds to the string in server registration
data
between the <user> and </user> tags. It is placed into the
server by registering a ChannelMap containing one or more channels to
which PutUserInfo(int, String) has been applied.
public void PutMime(int index,
String mime)
A full list can be found at:
ftp://ftp.isi.edu/in-notes/iana/assignments/media-types/media-types
NOTE: The MIME type information will only be sent
to the server if one of the PutData() methods is
called on this channel.
public int TypeID(String type)
public static final int TYPE_*
constants.
The String should be one of "int8", "int16", "int32", "int64"
"float32", "float64", "string", "bytearray", or "unknown".
Case is ignored.
For example, calling this function with "int8" returns
TYPE_INT8.
IllegalArgumentException - if the type is not one of the ones
listed above;
NullPointerException - if type is null.public String TypeName(int typeID)
ArrayOutOfBoundsException - If the typeID does not match
any of the allowed types.
public void PutData(int channelIndex,
byte[] rawData,
int typeID)
throws SAPIException
Note: the data is not copied, so do not overwrite it until it is Flushed.
channelIndex - The channel index.rawData - An array of bytes representing the data.typeID - An integer representing the type of the data.
SAPIException - If there is an error creating the channel locally.Source.Flush(ChannelMap),
PutData(int,byte[],int,ChannelMap.ByteOrderEnum)
public void PutData(int channelIndex,
byte[] rawData,
int typeID,
ChannelMap.ByteOrderEnum byteOrder)
throws SAPIException
Note: the data is not copied, so do not overwrite it until it is Flushed.
Note that this version of PutData is not available in the JavaBean/ActiveX API.
channelIndex - The index of the channel, obtained via
Add(String) or GetIndex(String).rawData - An array of bytes representing the data.typeID - An integer representing the type of the data.byteOrder - An enumerated type, one of LOCAL,
LSB, or MSB.
SAPIException - If there is an error creating the channel locally.Source.Flush(ChannelMap),
Add(String),
GetIndex(String)
public void PutDataAsFloat64(int channelIndex,
double[] data)
throws SAPIException
Note: the data is not copied, so do not overwrite it until it is Flushed.
SAPIExceptionPutData(int,byte[],int)
public void PutDataAsFloat32(int channelIndex,
float[] data)
throws SAPIException
Note: the data is not copied, so do not overwrite it until it is Flushed.
SAPIExceptionPutData(int,byte[],int)
public void PutDataAsInt64(int channelIndex,
long[] data)
throws SAPIException
Note: the data is not copied, so do not overwrite it until it is Flushed.
SAPIExceptionPutData(int,byte[],int)
public void PutDataAsInt32(int channelIndex,
int[] data)
throws SAPIException
Note: the data is not copied, so do not overwrite it until it is Flushed.
SAPIExceptionPutData(int,byte[],int)
public void PutDataAsInt16(int channelIndex,
short[] data)
throws SAPIException
Note: the data is not copied, so do not overwrite it until it is Flushed.
SAPIExceptionPutData(int,byte[],int)
public void PutDataAsInt8(int channelIndex,
byte[] data)
throws SAPIException
Note: the data is not copied, so do not overwrite it until it is Flushed.
SAPIExceptionPutData(int,byte[],int)
public void PutDataAsString(int channelIndex,
String data)
throws SAPIException
Note: the data is not copied, so do not overwrite it until it is Flushed.
SAPIExceptionPutData(int,byte[],int)
public void PutDataAsByteArray(int channelIndex,
byte[] data)
throws SAPIException
Note: the data is not copied, so do not overwrite it until it is Flushed.
SAPIExceptionPutData(int,byte[],int)
public final void PutUserInfo(int channelIndex,
String data)
throws SAPIException
Although there is no official standard for user data information, many viewers understand key/value pairs in the following form:
This method will work along with GetUserInfo(int) with data
(non registration) ChannelMaps. However, PutDataAsString(
int, String)/GetDataAsString(int) has more functionality in
this case and is recommended.
SAPIExceptionSink.RequestRegistration(),
Source.Register(ChannelMap)
public void PutDataRef(int destChannel,
ChannelMap sourceMap,
int sourceChannel)
throws SAPIException
this
map. The primary application of this method is in "pass-through"
PlugIns, such as VSource, which do nothing with the data other than
transfer it from one channel to another.
IndexOutOfRange - If either destChannel >=
this.NumberOfChannels()
or sourceChannel >= sourceMap.NumberOfChannels().
SAPIException - If there is a problem transferring the data.PutTimeRef(ChannelMap, int)
public void PutTime(double start,
double duration)
Clears the AutoTimeStamp setting, if any.
start - The absolute start time of the next frame.duration - The duration of the next frame.PutTimeAuto(String),
PutData(int,byte[],int),
Source.Flush(ChannelMap,boolean)public void PutTimes(double[] times)
PutData call.
Clears the AutoTimeStamp setting, if any.
times - The array of time points that applies to the data set.PutTimeAuto(String),
PutData(int,byte[],int),
Source.Flush(ChannelMap,boolean)
public void PutTimeRef(ChannelMap sourceMap,
int channelIndex)
PutTimes(sourceMap.GetTimes(channelIndex))
This function may be called once per frame, once per
channel, or once per point for a multi-point block, depending
on your application. The time reference must be compatable
with the data subsequently added, or else an exception
will be thrown on the PutData call.
Clears the PutTimeAuto setting, if any.
sourceMap - The map from which to copy the time reference.channelIndex - The index of the channel whose reference to copy.PutTimeAuto(String),
PutTimes(double[]),
PutData(int,byte[],int),
Source.Flush(ChannelMap,boolean)
public void PutTimeAuto(String timeMode)
throws IllegalArgumentException
If the timeMode is "next", then the time-stamp
increments starting from 1 each time Source.Flush is
called.
If the timeMode is "timeofday", then the time-stamp is
set equal to the client-side system clock time each time
PutData is called.
If the timeMode is "server", then the time-stamp is
set equal to the server-side system clock time at the point when
the flushed frame is placed in the ring buffer. This mode should
not be used in conjunction with any other time-stamping style
within a single frame, although it can be changed from flush to
flush.
If the mode is not set, it defaults to "server".
The default units for auto timestamps are seconds since 1970, stored in a double precision number (System.currentTimeMillis()/1000.). Note that this results in approximately 1 micro-second time resolution. For higher resolution, use manual (non-auto) timestamps, e.g. use a relative (zero-based) start time instead of 1970.
timeMode - The mode setting, one of "next", "timeofday", or
"server".
IllegalArgumentException - If the mode is not correct.Source.Flush(ChannelMap,boolean)public int NumberOfChannels()
Add(String)public String toString()
String about the state of
this channel map.
toString in class Objectpublic final String[] GetNodeList()
ChannelTree class for
per-node heirarchy construction and identification.
For example, if a ChannelMap contains the channel
"/Server/Source/Channel", the return result would be "/Server",
"/Server/Source", and "/Server/Source/Channel". However, if
the channel was "Source/Channel", only "Source" and
"Source/Channel" would be returned.
public final String[] GetChannelList()
ChannelMap map= ...
String[] list=new String[map.NumberOfChannels()];
for (int ii=0; ii<list.length; ++ii)
list[ii]=map.GetName(ii);
However, this function is slightly more efficient.
public final String[] GetFolderList()
Sink.RequestRegistration(ChannelMap).
Sink.RequestRegistration(ChannelMap)public final String[] GetServerList()
ChannelTree class for
per-node heirarchy construction and identification.
public final String[] GetSinkList()
ChannelTree class for
per-node heirarchy construction and identification.
Sinks contained in
this ChannelMap. This is only useful for maps returned from
a registration request.
public final String[] GetSourceList()
ChannelTree class for
per-node heirarchy construction and identification.
Sources contained in
this ChannelMap. This is only useful for maps returned from
a registration request.
public final String[] GetPlugInList()
ChannelTree class for
per-node heirarchy construction and identification.
PlugIns contained in
this ChannelMap. This is only useful for maps returned from
a registration request.
public int[] Search(String mimeType,
String keywords)
ChannelMap
for the specified keyword and mimeType.
All channels of fetched data currently in the map are
iterrogated to see if their MIME type exactly matches the specified
mimeType parameter. If they do, the data for that
channel is searched to see if every key word in the input set exists.
If so, the channel is added to the array of channels returned.
Keywords should be separated by spaces. If either parameter is null, that constraint is ignored on the search.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||