added kdoc-style documentation comments

This commit is contained in:
darkeye 2000-11-13 18:46:50 +00:00
parent 17bccc23c3
commit ace84836f3
8 changed files with 471 additions and 232 deletions

View File

@ -9,33 +9,21 @@
Author : $Author$ Author : $Author$
Location : $Source$ Location : $Source$
Abstract :
A configuration file representation. The file is of the syntax:
# this is a whole line comment
key = value
an ugly key name = long value # this end is a comment too
also empty lines are ignored and all white space is removed
from the front and end of keys / values
Copyright notice: Copyright notice:
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
USA.
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -172,6 +160,9 @@ Config :: read ( istream & is ) throw ( Exception )
$Source$ $Source$
$Log$ $Log$
Revision 1.2 2000/11/13 18:46:50 darkeye
added kdoc-style documentation comments
Revision 1.1 2000/11/08 17:29:50 darkeye Revision 1.1 2000/11/08 17:29:50 darkeye
added configuration file reader added configuration file reader

View File

@ -9,40 +9,21 @@
Author : $Author$ Author : $Author$
Location : $Source$ Location : $Source$
Abstract :
A configuration file representation. The file is of the syntax:
[section1]
# this is a whole line comment
key = value
an ugly key name = long value # this end is a comment too
[section2]
# this is a whole line comment in section 2
key = value
an ugly key name = long value # this end is a comment too
also empty lines are ignored and all white space is removed
from the front and end of keys / values
Copyright notice: Copyright notice:
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
USA.
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
#ifndef CONFIG_H #ifndef CONFIG_H
@ -72,17 +53,50 @@
/* =============================================================== data types */ /* =============================================================== data types */
/*------------------------------------------------------------------------------ /**
* A configuration file representation. The file is of the syntax:
* *
*----------------------------------------------------------------------------*/ * <pre>
* [section1]
* # this is a whole line comment
* key = value
* an ugly key name = long value # this end is a comment too
*
* [section2]
* # this is a whole line comment in section 2
* key = value
* an ugly key name = long value # this end is a comment too
* </pre>
*
* also empty lines are ignored and all white space is removed
* from the front and end of keys / values
*
* Knwon problem: you can't use '#' in any part of a key / value pair
*
* @author $Author$
* @version $Revision$
*/
class Config : public virtual Referable class Config : public virtual Referable
{ {
private: private:
/**
* Type declaration of the hash table type.
*/
typedef hash_map<string, ConfigSection> TableType; typedef hash_map<string, ConfigSection> TableType;
/**
* Hash table holding the configuration sections.
*
* @see ConfigSection
*/
TableType table; TableType table;
/**
* Hash table holding the configuration sections.
*
* @see ConfigSection
*/
string currentSection; string currentSection;
@ -91,26 +105,41 @@ class Config : public virtual Referable
public: public:
/**
* Default constructor.
*
* @exception Exception
*/
inline inline
Config ( void ) throw ( Exception ) Config ( void ) throw ( Exception )
{ {
} }
/**
* Constructor based on an input stream.
*
* @param is configuration will be read from this input stream
* until end of stream is reached.
* @exception Exception
*/
inline inline
Config ( istream & is ) throw ( Exception ) Config ( istream & is ) throw ( Exception )
{ {
read( is ); read( is );
} }
/**
* Destructor.
*
* @exception Exception
*/
inline virtual inline virtual
~Config ( void ) throw ( Exception ) ~Config ( void ) throw ( Exception )
{ {
} }
/* /* TODO
inline inline
Config ( const Config & di ) throw ( Exception ) Config ( const Config & di ) throw ( Exception )
@ -124,6 +153,12 @@ class Config : public virtual Referable
} }
*/ */
/**
* Delete the configuration information stored in the object.
* Resets the object to a clean state.
*
* @exception Exception
*/
inline virtual void inline virtual void
reset ( void ) throw ( Exception ) reset ( void ) throw ( Exception )
{ {
@ -131,15 +166,33 @@ class Config : public virtual Referable
currentSection = ""; currentSection = "";
} }
/**
* Read a line of confiugration information.
*
* @param line the line to read.
* @return true if the line was correct, false otherwise.
* @exception Exception
*/
virtual bool virtual bool
addLine ( const char * line ) throw ( Exception ); addLine ( const char * line ) throw ( Exception );
/**
* Read a line of confiugration information.
*
* @param line the line to read.
* @return true if the line was correct, false otherwise.
* @exception Exception
*/
virtual void virtual void
read ( istream & is ) throw ( Exception ); read ( istream & is ) throw ( Exception );
/**
* Get a ConfigSection by name.
*
* @param key the name of the ConfigSection
* @return the ConfigSection requested, or NULL if it doesn't exists.
* @exception Exception
*/
virtual const ConfigSection * virtual const ConfigSection *
get ( const char * key ) const throw ( Exception ); get ( const char * key ) const throw ( Exception );
}; };
@ -160,6 +213,9 @@ class Config : public virtual Referable
$Source$ $Source$
$Log$ $Log$
Revision 1.3 2000/11/13 18:46:50 darkeye
added kdoc-style documentation comments
Revision 1.2 2000/11/09 22:07:19 darkeye Revision 1.2 2000/11/09 22:07:19 darkeye
added constructor with istream added constructor with istream

View File

@ -9,33 +9,21 @@
Author : $Author$ Author : $Author$
Location : $Source$ Location : $Source$
Abstract :
A configuration file representation. The file is of the syntax:
# this is a whole line comment
key = value
an ugly key name = long value # this end is a comment too
also empty lines are ignored and all white space is removed
from the front and end of keys / values
Copyright notice: Copyright notice:
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
USA.
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -180,6 +168,9 @@ ConfigSection :: addLine ( const char * line ) throw ( Exception )
$Source$ $Source$
$Log$ $Log$
Revision 1.3 2000/11/13 18:46:50 darkeye
added kdoc-style documentation comments
Revision 1.2 2000/11/09 22:08:17 darkeye Revision 1.2 2000/11/09 22:08:17 darkeye
added function getForSure added function getForSure

View File

@ -9,33 +9,21 @@
Author : $Author$ Author : $Author$
Location : $Source$ Location : $Source$
Abstract :
A configuration file representation. The file is of the syntax:
# this is a whole line comment
key = value
an ugly key name = long value # this end is a comment too
also empty lines are ignored and all white space is removed
from the front and end of keys / values
Copyright notice: Copyright notice:
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
USA.
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
#ifndef CONFIG_SECTION_H #ifndef CONFIG_SECTION_H
@ -62,39 +50,65 @@
/* =============================================================== data types */ /* =============================================================== data types */
/*------------------------------------------------------------------------------ /**
* A configuration file representation. The file is of the syntax:
* *
*----------------------------------------------------------------------------*/ * <pre>
* # this is a whole line comment
* key = value
* an ugly key name = long value # this end is a comment too
* </pre>
*
* also empty lines are ignored and all white space is removed
* from the front and end of keys / values
*
* Knwon problem: you can't use '#' in any part of a key / value pair
*
* @author $Author$
* @version $Revision$
*/
class ConfigSection : public virtual Referable class ConfigSection : public virtual Referable
{ {
private: private:
/**
* Type of the hash table used in this class.
*/
typedef hash_map<string, string> TableType; typedef hash_map<string, string> TableType;
/**
* Hash table holding the configuration information.
*/
TableType table; TableType table;
void
init ( void ) throw ( Exception );
protected: protected:
public: public:
/**
* Default constructor.
*
* @exception Exception
*/
inline inline
ConfigSection ( void ) throw ( Exception ) ConfigSection ( void ) throw ( Exception )
{ {
} }
/**
* Destructor.
*
* @exception Exception
*/
inline virtual inline virtual
~ConfigSection ( void ) throw ( Exception ) ~ConfigSection ( void ) throw ( Exception )
{ {
} }
/* /* TODO
inline inline
ConfigSection ( const ConfigSection & di ) throw ( Exception ) ConfigSection ( const ConfigSection & di ) throw ( Exception )
@ -108,15 +122,38 @@ class ConfigSection : public virtual Referable
} }
*/ */
/**
* Add a key / value pair to the configuration information.
*
* @param key the key to add the value by
* @param value the value to add for the key
* @return true if adding was successful, false otherwise
* @exception Exception
*/
virtual bool virtual bool
add ( const char * key, add ( const char * key,
const char * value ) throw ( Exception ); const char * value ) throw ( Exception );
/**
* Get a value for a key.
*
* @param key the key to get the value for
* @return the value for the key, or NULL if the key doesn't exist.
* @exception Exception
*/
virtual const char * virtual const char *
get ( const char * key ) const throw ( Exception ); get ( const char * key ) const throw ( Exception );
/**
* Get a value for a key, or throw an Exception.
*
* @param key the key to get the value for
* @param message1 message part 1 of the Exception to be thrown.
* @param message2 message part 2 of the Exception to be thrown.
* @param code error code of the Exception to be thrown.
* @return the value for the key. The return value is never NULL.
* @exception Exception
*/
virtual const char * virtual const char *
getForSure ( const char * key, getForSure ( const char * key,
const char * message1 = 0, const char * message1 = 0,
@ -124,7 +161,13 @@ class ConfigSection : public virtual Referable
int code = 0 ) const int code = 0 ) const
throw ( Exception ); throw ( Exception );
/**
* Add a line of configuration information.
*
* @param line the line to add.
* @return true if a new key was added, false otherwise.
* @exception Exception
*/
virtual bool virtual bool
addLine ( const char * line ) throw ( Exception ); addLine ( const char * line ) throw ( Exception );
}; };
@ -145,6 +188,9 @@ class ConfigSection : public virtual Referable
$Source$ $Source$
$Log$ $Log$
Revision 1.3 2000/11/13 18:46:50 darkeye
added kdoc-style documentation comments
Revision 1.2 2000/11/09 22:08:17 darkeye Revision 1.2 2000/11/09 22:08:17 darkeye
added function getForSure added function getForSure

View File

@ -9,26 +9,21 @@
Author : $Author$ Author : $Author$
Location : $Source$ Location : $Source$
Abstract :
Connects a source to a sink
Copyright notice: Copyright notice:
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
USA.
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -333,8 +328,11 @@ Connector :: close ( void ) throw ( Exception )
$Source$ $Source$
$Log$ $Log$
Revision 1.1 2000/11/05 10:05:49 darkeye Revision 1.2 2000/11/13 18:46:50 darkeye
Initial revision added kdoc-style documentation comments
Revision 1.1.1.1 2000/11/05 10:05:49 darkeye
initial version
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/

View File

@ -9,26 +9,21 @@
Author : $Author$ Author : $Author$
Location : $Source$ Location : $Source$
Abstract :
Connects a source to a sink
Copyright notice: Copyright notice:
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
USA.
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
#ifndef CONNECTOR_H #ifndef CONNECTOR_H
@ -55,30 +50,56 @@
/* =============================================================== data types */ /* =============================================================== data types */
/*------------------------------------------------------------------------------ /**
* Connects a source to one or more sinks.
* *
*----------------------------------------------------------------------------*/ * @author $Author$
* @version $Revision$
*/
class Connector : public virtual Referable class Connector : public virtual Referable
{ {
private: private:
/**
* The source to read from.
*/
Ref<Source> source; Ref<Source> source;
/**
* The sinks to connect the source to.
*/
Ref<Sink> * sinks; Ref<Sink> * sinks;
/**
* Total number of sinks.
*/
unsigned int numSinks; unsigned int numSinks;
/**
* Initialize the object.
*
* @param source the source to read from.
* @exception Exception
*/
void void
init ( Source * source ) throw ( Exception ); init ( Source * source ) throw ( Exception );
/**
* De-initialize the object.
*
* @exception Exception
*/
void void
strip ( void ) throw ( Exception ); strip ( void ) throw ( Exception );
protected: protected:
/**
* Default constructor. Always throws an Exception.
*
* @exception Exception
*/
inline inline
Connector ( void ) throw ( Exception ) Connector ( void ) throw ( Exception )
{ {
@ -88,13 +109,25 @@ class Connector : public virtual Referable
public: public:
/**
* Constructor based on a Source.
*
* @param source the source to connect to the sinks.
* @exception Exception
*/
inline inline
Connector ( Source * source ) throw ( Exception ) Connector ( Source * source ) throw ( Exception )
{ {
init( source); init( source);
} }
/**
* Constructor based on a Source and a Sink.
*
* @param source the source to connect to the sinks.
* @param sink a sink to connect to the source.
* @exception Exception
*/
inline inline
Connector ( Source * source, Connector ( Source * source,
Sink * sink ) throw ( Exception ) Sink * sink ) throw ( Exception )
@ -103,47 +136,107 @@ class Connector : public virtual Referable
attach( sink); attach( sink);
} }
/**
* Copy constructor.
*
* @param connector the object to copy.
* @exception Exception
*/
Connector ( const Connector & connector ) throw ( Exception ); Connector ( const Connector & connector ) throw ( Exception );
/**
* Destructor.
*
* @exception Exception
*/
inline virtual inline virtual
~Connector( void ) ~Connector( void ) throw ( Exception )
{ {
strip(); strip();
} }
/**
* Assignment operator.
*
* @param connector the object to assign to this one.
* @return a reference to this object.
* @exception Exception
*/
virtual Connector & virtual Connector &
operator= ( const Connector & connector ) throw ( Exception ); operator= ( const Connector & connector ) throw ( Exception );
/**
* Get the number of Sinks in the Connector.
*
* @return the number of Sinks in the Connector.
* @exception Exception
*/
inline unsigned int inline unsigned int
getNumSinks ( void ) const throw () getNumSinks ( void ) const throw ()
{ {
return numSinks; return numSinks;
} }
/**
* Attach a Sink to the Source of this Connector.
*
* @param sink the Sink to attach.
* @exception Exception
*/
void void
attach ( Sink * sink ) throw ( Exception ); attach ( Sink * sink ) throw ( Exception );
/**
* Detach an already attached Sink from the Source of this Connector.
*
* @param sink the Sink to detach.
* @return true if the detachment was successful, false otherwise.
* @exception Exception
*/
bool bool
detach ( Sink * sink ) throw ( Exception ); detach ( Sink * sink ) throw ( Exception );
/**
* Open the connector. Opens the Source and the Sinks if necessary.
*
* @return true if opening was successful, false otherwise.
* @exception Exception
*/
bool bool
open ( void ) throw ( Exception ); open ( void ) throw ( Exception );
/**
* Transfer a given amount of data from the Source to all the
* Sinks attached.
* If an attached Sink closes or encounteres an error during the
* process, it is detached and the function carries on with the
* rest of the Sinks. If no Sinks remain, or an error is encountered
* with the Source, the function returns prematurely.
*
* @param bytes the amount of data to transfer, in bytes
* @param bufSize the size of the buffer to use for transfering.
* This amount of data is read from the Source and
* written to each Sink on each turn.
* @param sec the number of seconds to wait for the Source to have
* data available in each turn, and the number of seconds
* to wait for the Sinks to accept data.
* @param usec the number of micros seconds to wait for the Source to
* have data available in each turn, and the number of
* micro seconds to wait for the Sinks to accept data.
* @return the number of bytes read from the Source.
* @exception Exception
*/
unsigned int unsigned int
transfer ( unsigned int bytes, transfer ( unsigned int bytes,
unsigned int bufSize, unsigned int bufSize,
unsigned int sec, unsigned int sec,
unsigned int usec ) throw ( Exception ); unsigned int usec ) throw ( Exception );
/**
* Close the Connector. The Source and all Sinks are closed.
*
* @exception Exception
*/
void void
close ( void ) throw ( Exception ); close ( void ) throw ( Exception );
}; };
@ -164,8 +257,11 @@ class Connector : public virtual Referable
$Source$ $Source$
$Log$ $Log$
Revision 1.1 2000/11/05 10:05:49 darkeye Revision 1.2 2000/11/13 18:46:50 darkeye
Initial revision added kdoc-style documentation comments
Revision 1.1.1.1 2000/11/05 10:05:49 darkeye
initial version
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/

View File

@ -9,26 +9,22 @@
Author : $Author$ Author : $Author$
Location : $Source$ Location : $Source$
Abstract :
Program main object
Copyright notice: Copyright notice:
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
USA.
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -432,6 +428,9 @@ DarkIce :: run ( void ) throw ( Exception )
$Source$ $Source$
$Log$ $Log$
Revision 1.6 2000/11/13 18:46:50 darkeye
added kdoc-style documentation comments
Revision 1.5 2000/11/10 20:16:21 darkeye Revision 1.5 2000/11/10 20:16:21 darkeye
first real tests with multiple streaming first real tests with multiple streaming

View File

@ -9,26 +9,21 @@
Author : $Author$ Author : $Author$
Location : $Source$ Location : $Source$
Abstract :
Program main object
Copyright notice: Copyright notice:
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
USA.
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
#ifndef DARK_ICE_H #ifndef DARK_ICE_H
@ -75,15 +70,24 @@
/* =============================================================== data types */ /* =============================================================== data types */
/*------------------------------------------------------------------------------ /**
* Program main object.
* *
*----------------------------------------------------------------------------*/ * @author $Author$
* @version $Revision$
*/
class DarkIce : public virtual Referable class DarkIce : public virtual Referable
{ {
private: private:
/**
* The maximum number of supported outputs.
*/
static const unsigned int maxOutput = 8; static const unsigned int maxOutput = 8;
/**
* Type describing each output.
*/
typedef struct { typedef struct {
Ref<PipeSink> encInPipe; Ref<PipeSink> encInPipe;
Ref<BufferedSink> encIn; Ref<BufferedSink> encIn;
@ -95,23 +99,58 @@ class DarkIce : public virtual Referable
pid_t pid; pid_t pid;
} Output; } Output;
/**
* Duration of playing, in seconds.
*/
unsigned int duration; unsigned int duration;
/**
* The dsp to record from.
*/
Ref<OssDspSource> dsp; Ref<OssDspSource> dsp;
/**
* The encoding Connector, connecting the dsp to the encoders.
*/
Ref<Connector> encConnector; Ref<Connector> encConnector;
/**
* The outputs.
*/
Output outputs[maxOutput]; Output outputs[maxOutput];
/**
* Number of outputs.
*/
unsigned int noOutputs; unsigned int noOutputs;
/**
* Initialize the object.
*
* @param config the config Object to read initialization
* information from.
* @exception Exception
*/
void void
init ( const Config & config ) throw ( Exception ); init ( const Config & config ) throw ( Exception );
/**
* Start encoding. Spawns all encoders, opens the dsp and
* starts sending data to the encoders.
*
* @return if encoding was successful.
* @exception Exception
*/
bool bool
encode ( void ) throw ( Exception ); encode ( void ) throw ( Exception );
/**
* Start shouting. fork()-s a process for each output, reads
* the output of the encoders and sends them to an IceCast server.
*
* @return if shouting was successful.
* @exception Exception
*/
bool bool
shout ( unsigned int ) throw ( Exception ); shout ( unsigned int ) throw ( Exception );
@ -124,23 +163,37 @@ class DarkIce : public virtual Referable
public: public:
/**
* Default constructor.
*
* @exception Exception
*/
inline inline
DarkIce ( void ) throw ( Exception ) DarkIce ( void ) throw ( Exception )
{ {
} }
/**
* Constructor based on command line parameters.
*
* @param argc number of arguments
* @param argv the command line arguments.
* @exception Exception
*/
DarkIce ( int argc, DarkIce ( int argc,
char * argv[] ) throw ( Exception ); char * argv[] ) throw ( Exception );
/**
* Destructor.
*
* @exception Exception
*/
inline virtual inline virtual
~DarkIce ( void ) throw ( Exception ) ~DarkIce ( void ) throw ( Exception )
{ {
} }
/* TODO
/*
inline inline
DarkIce ( const DarkIce & di ) throw ( Exception ) DarkIce ( const DarkIce & di ) throw ( Exception )
@ -154,6 +207,12 @@ class DarkIce : public virtual Referable
} }
*/ */
/**
* Run the process of recording / encoding / sending to the servers.
*
* @return 0 on success
* @exception Exception
*/
virtual int virtual int
run ( void ) throw ( Exception ); run ( void ) throw ( Exception );
@ -175,6 +234,9 @@ class DarkIce : public virtual Referable
$Source$ $Source$
$Log$ $Log$
Revision 1.4 2000/11/13 18:46:50 darkeye
added kdoc-style documentation comments
Revision 1.3 2000/11/10 20:16:21 darkeye Revision 1.3 2000/11/10 20:16:21 darkeye
first real tests with multiple streaming first real tests with multiple streaming