added module core
This commit is contained in:
parent
a0fde3b4cd
commit
b6719e6b7c
|
@ -0,0 +1,87 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
#
|
||||||
|
# This file is part of the LiveSupport project.
|
||||||
|
# http://livesupport.campware.org/
|
||||||
|
# To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
#
|
||||||
|
# LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with LiveSupport; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Author : $Author: maroy $
|
||||||
|
# Version : $Revision: 1.1 $
|
||||||
|
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/bin/autogen.sh,v $
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Run this to set up the build system: configure, makefiles, etc.
|
||||||
|
# (based on the version in enlightenment's cvs)
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
package="Core"
|
||||||
|
|
||||||
|
# assume we're in $basedir/bin
|
||||||
|
basedir=`dirname $0`/..
|
||||||
|
test -z "$basedir" && basedir=.
|
||||||
|
|
||||||
|
tmpdir=$basedir/tmp
|
||||||
|
|
||||||
|
cd "$tmpdir"
|
||||||
|
DIE=0
|
||||||
|
|
||||||
|
# look at all other directories as seen from ${basedir}/tmp
|
||||||
|
tmpdir=.
|
||||||
|
bindir=../bin
|
||||||
|
etcdir=../etc
|
||||||
|
|
||||||
|
(autoheader --version) < /dev/null > /dev/null 2>&1 || {
|
||||||
|
echo
|
||||||
|
echo "You must have autoconf installed to compile $package."
|
||||||
|
echo "Download the appropriate package for your distribution,"
|
||||||
|
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
|
||||||
|
DIE=1
|
||||||
|
}
|
||||||
|
|
||||||
|
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
|
||||||
|
echo
|
||||||
|
echo "You must have autoconf installed to compile $package."
|
||||||
|
echo "Download the appropriate package for your distribution,"
|
||||||
|
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
|
||||||
|
DIE=1
|
||||||
|
}
|
||||||
|
|
||||||
|
if test "$DIE" -eq 1; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -z "$*"; then
|
||||||
|
echo "I am going to run ./configure with no arguments - if you wish "
|
||||||
|
echo "to pass any to it, please specify them on the $0 command line."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Generating configuration files for $package, please wait...."
|
||||||
|
|
||||||
|
configure_ac=${etcdir}/configure.ac
|
||||||
|
configure=${tmpdir}/configure
|
||||||
|
|
||||||
|
#echo " aclocal $ACLOCAL_FLAGS"
|
||||||
|
#aclocal $ACLOCAL_FLAGS
|
||||||
|
echo " autoheader ${configure_ac}"
|
||||||
|
autoheader ${configure_ac}
|
||||||
|
echo " autoconf -o ${configure} ${configure_ac}"
|
||||||
|
autoconf -o ${configure} ${configure_ac}
|
||||||
|
|
||||||
|
${configure} "$@" && echo
|
|
@ -0,0 +1 @@
|
||||||
|
keep me
|
|
@ -0,0 +1,136 @@
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
#
|
||||||
|
# This file is part of the LiveSupport project.
|
||||||
|
# http://livesupport.campware.org/
|
||||||
|
# To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
#
|
||||||
|
# LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with LiveSupport; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Author : $Author: maroy $
|
||||||
|
# Version : $Revision: 1.1 $
|
||||||
|
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/etc/Makefile.in,v $
|
||||||
|
#
|
||||||
|
# @configure_input@
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# General command definitions
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
MKDIR = mkdir -p
|
||||||
|
RM = rm -f
|
||||||
|
RMDIR = rm -rf
|
||||||
|
DOXYGEN = doxygen
|
||||||
|
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Basic directory and file definitions
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
BASE_DIR = @builddir@
|
||||||
|
DOC_DIR = ${BASE_DIR}/doc
|
||||||
|
DOXYGEN_DIR = ${DOC_DIR}/doxygen
|
||||||
|
ETC_DIR = ${BASE_DIR}/etc
|
||||||
|
INCLUDE_DIR = ${BASE_DIR}/include
|
||||||
|
LIB_DIR = ${BASE_DIR}/lib
|
||||||
|
SRC_DIR = ${BASE_DIR}/src
|
||||||
|
TMP_DIR = ${BASE_DIR}/tmp
|
||||||
|
|
||||||
|
USR_DIR = ${BASE_DIR}/../../usr
|
||||||
|
USR_INCLUDE_DIR = ${USR_DIR}/include
|
||||||
|
USR_LIB_DIR = ${USR_DIR}/lib
|
||||||
|
BOOST_INCLUDE_DIR = ${USR_INCLUDE_DIR}/boost-1_31
|
||||||
|
LIBXMLPP_INCLUDE_DIR = ${USR_INCLUDE_DIR}/libxml++-1.0
|
||||||
|
|
||||||
|
VPATH = ${SRC_DIR}
|
||||||
|
|
||||||
|
CORE_LIB = livesupport_core
|
||||||
|
CORE_LIB_FILE = ${LIB_DIR}/lib${CORE_LIB}.a
|
||||||
|
TEST_RUNNER = ${TMP_DIR}/testRunner
|
||||||
|
|
||||||
|
DOXYGEN_CONFIG = ${ETC_DIR}/doxygen.config
|
||||||
|
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Configuration parameters
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
CPPFLAGS = @CPPFLAGS@
|
||||||
|
CXXFLAGS = @CXXFLAGS@ @DEFS@ -pedantic -Wall -Wno-long-long \
|
||||||
|
-I${USR_INCLUDE_DIR} \
|
||||||
|
-I${BOOST_INCLUDE_DIR} \
|
||||||
|
-I${LIBXMLPP_INCLUDE_DIR} \
|
||||||
|
-I${INCLUDE_DIR} -I${TMP_DIR}
|
||||||
|
LDFLAGS = @LDFLAGS@ -L${USR_LIB_DIR} -L${LIB_DIR}
|
||||||
|
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Dependencies
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
CORE_LIB_OBJS = ${TMP_DIR}/UniqueId.o \
|
||||||
|
${TMP_DIR}/Playlist.o
|
||||||
|
TEST_RUNNER_OBJS = ${TMP_DIR}/PlaylistTest.o ${TMP_DIR}/TestRunner.o
|
||||||
|
TEST_RUNNER_LIBS = -l${CORE_LIB} -lxml++-1.0 -lcppunit -ldl
|
||||||
|
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Targets
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
.PHONY: all dir_setup doc clean docclean depclean distclean
|
||||||
|
|
||||||
|
all: dir_setup ${CORE_LIB_FILE}
|
||||||
|
|
||||||
|
dir_setup: ${TMP_DIR} ${DOXYGEN_DIR}
|
||||||
|
|
||||||
|
doc:
|
||||||
|
${DOXYGEN} ${DOXYGEN_CONFIG}
|
||||||
|
|
||||||
|
clean:
|
||||||
|
${RM} ${CORE_LIB_OBJS} ${CORE_LIB_FILE}
|
||||||
|
${RM} ${TEST_RUNNER_OBJS} ${TEST_RUNNER}
|
||||||
|
|
||||||
|
docclean:
|
||||||
|
${RMDIR} ${DOXYGEN_DIR}/html
|
||||||
|
|
||||||
|
depclean: clean
|
||||||
|
|
||||||
|
distclean: clean docclean
|
||||||
|
${RMDIR} ${TMP_DIR}/config* ${TMP_DIR}/autom4te*
|
||||||
|
|
||||||
|
check: ${TEST_RUNNER}
|
||||||
|
LD_LIBRARY_PATH=${USR_LIB_DIR} ${TEST_RUNNER}
|
||||||
|
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Specific targets
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
${CORE_LIB_FILE}: ${CORE_LIB_OBJS}
|
||||||
|
${AR} crus $@ $^
|
||||||
|
|
||||||
|
${TMP_DIR}:
|
||||||
|
${MKDIR} ${TMP_DIR}
|
||||||
|
|
||||||
|
${DOXYGEN_DIR}:
|
||||||
|
${MKDIR} ${DOXYGEN_DIR}
|
||||||
|
|
||||||
|
${TEST_RUNNER}: ${TEST_RUNNER_OBJS} ${CORE_LIB_FILE}
|
||||||
|
${CXX} ${LDFLAGS} -o $@ ${TEST_RUNNER_OBJS} ${TEST_RUNNER_LIBS}
|
||||||
|
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Pattern rules
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
${TMP_DIR}/%.o : ${SRC_DIR}/%.cxx
|
||||||
|
${CXX} ${CPPFLAGS} ${CXXFLAGS} -c -o $@ $<
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
dnl-----------------------------------------------------------------------------
|
||||||
|
dnl Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
dnl
|
||||||
|
dnl This file is part of the LiveSupport project.
|
||||||
|
dnl http://livesupport.campware.org/
|
||||||
|
dnl To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
dnl
|
||||||
|
dnl LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
dnl it under the terms of the GNU General Public License as published by
|
||||||
|
dnl the Free Software Foundation; either version 2 of the License, or
|
||||||
|
dnl (at your option) any later version.
|
||||||
|
dnl
|
||||||
|
dnl LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
dnl GNU General Public License for more details.
|
||||||
|
dnl
|
||||||
|
dnl You should have received a copy of the GNU General Public License
|
||||||
|
dnl along with LiveSupport; if not, write to the Free Software
|
||||||
|
dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
dnl
|
||||||
|
dnl
|
||||||
|
dnl Author : $Author: maroy $
|
||||||
|
dnl Version : $Revision: 1.1 $
|
||||||
|
dnl Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/etc/configure.ac,v $
|
||||||
|
dnl-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
dnl-----------------------------------------------------------------------------
|
||||||
|
dnl NOTE: Run all configure related scripts from the tmp directory of the
|
||||||
|
dnl project.
|
||||||
|
dnl This is due to the fact that configure spreads a lot of trash around,
|
||||||
|
dnl like atom4te cache directories, config.* files, etc. into the directory
|
||||||
|
dnl it is being run from. We clearly don't want these in our base directory.
|
||||||
|
dnl-----------------------------------------------------------------------------
|
||||||
|
AC_INIT(Core, 1.0, bugs@campware.org)
|
||||||
|
AC_PREREQ(2.59)
|
||||||
|
AC_COPYRIGHT([Copyright (c) 2004 Media Development Loan Fund under the GNU GPL])
|
||||||
|
AC_REVISION($Revision: 1.1 $)
|
||||||
|
|
||||||
|
AC_CONFIG_SRCDIR(../src/UniqueId.cxx)
|
||||||
|
|
||||||
|
AC_CONFIG_HEADERS(configure.h)
|
||||||
|
AC_PROG_CXX()
|
||||||
|
|
||||||
|
AC_CHECK_HEADERS()
|
||||||
|
|
||||||
|
AC_CONFIG_FILES(../Makefile:../etc/Makefile.in)
|
||||||
|
|
||||||
|
AC_OUTPUT()
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<!DOCTYPE playlist [
|
||||||
|
|
||||||
|
<!ELEMENT playlist EMPTY >
|
||||||
|
<!ATTLIST playlist id NMTOKEN #REQUIRED >
|
||||||
|
<!ATTLIST playlist playlength NMTOKEN #REQUIRED >
|
||||||
|
]>
|
||||||
|
<playlist id="1" playlength="01:30:00.000"/>
|
|
@ -0,0 +1,99 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: maroy $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Configurable.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef LiveSupport_Core_Configurable_h
|
||||||
|
#define LiveSupport_Core_Configurable_h
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#error This is a C++ include file
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <libxml++/libxml++.h>
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/Ptr.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace Core {
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An interface marking a class configurable by an XML element.
|
||||||
|
*
|
||||||
|
* @author $Author: maroy $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
*/
|
||||||
|
class Configurable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Configure the object based on the XML element supplied.
|
||||||
|
* The supplied element is expected to be of the name
|
||||||
|
* returned by configElementName().
|
||||||
|
*
|
||||||
|
* @param element the XML element to configure the object from.
|
||||||
|
* @exception std::invalid_argument if the supplied XML element
|
||||||
|
* contains bad configuraiton information
|
||||||
|
* @exception std::logic_error if the object has already
|
||||||
|
* been configured, and can not be reconfigured.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
configure(const xmlpp::Element & element)
|
||||||
|
throw (std::invalid_argument,
|
||||||
|
std::logic_error)
|
||||||
|
= 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================= external data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ====================================================== function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Core
|
||||||
|
} // namespace LiveSupport
|
||||||
|
|
||||||
|
#endif // LiveSupport_Core_Configurable_h
|
||||||
|
|
|
@ -0,0 +1,125 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: maroy $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Installable.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef LiveSupport_Core_Installable_h
|
||||||
|
#define LiveSupport_Core_Installable_h
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#error This is a C++ include file
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/Ptr.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace Core {
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An interface for having objects that can install themselves.
|
||||||
|
* The concept of installation means setting up for long-term use.
|
||||||
|
* When something installs, it creates databases, writes configuration
|
||||||
|
* files, etc. It sets up the object to be run. This is not to be
|
||||||
|
* confused with instance initialization, e.g. when a server is started
|
||||||
|
* or stopped.
|
||||||
|
*
|
||||||
|
* The following life cycle is expected from systems impelementing this
|
||||||
|
* interface:
|
||||||
|
*
|
||||||
|
* <ul>
|
||||||
|
* <li>install</li>
|
||||||
|
* <li><ul>
|
||||||
|
* <li>start</li>
|
||||||
|
* <li>stop</li>
|
||||||
|
* <li>start</li>
|
||||||
|
* <li>stop</li>
|
||||||
|
* </ul></li>
|
||||||
|
* <li>uninstall</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* Later more stages will be added, and load/save (externalization)
|
||||||
|
* facilities.
|
||||||
|
*
|
||||||
|
* @author $Author: maroy $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
*/
|
||||||
|
class Installable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Install the component.
|
||||||
|
* This step involves creating the environment in which the component
|
||||||
|
* will run. This may be creation of coniguration files,
|
||||||
|
* database tables, etc.
|
||||||
|
*
|
||||||
|
* @exception std::exception on installation problems.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
install(void) throw (std::exception)
|
||||||
|
= 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uninstall the component.
|
||||||
|
* Removes all the resources created in the install step.
|
||||||
|
*
|
||||||
|
* @exception std::exception on unistallation problems.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
uninstall(void) throw (std::exception)
|
||||||
|
= 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================= external data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ====================================================== function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Core
|
||||||
|
} // namespace LiveSupport
|
||||||
|
|
||||||
|
#endif // LiveSupport_Core_Installable_h
|
||||||
|
|
|
@ -0,0 +1,185 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: maroy $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Playlist.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef LiveSupport_Core_Playlist_h
|
||||||
|
#define LiveSupport_Core_Playlist_h
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#error This is a C++ include file
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <libxml++/libxml++.h>
|
||||||
|
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/Ptr.h"
|
||||||
|
#include "LiveSupport/Core/UniqueId.h"
|
||||||
|
#include "LiveSupport/Core/Configurable.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace Core {
|
||||||
|
|
||||||
|
using namespace boost::posix_time;
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class representing playlist.
|
||||||
|
* Playlist are containers for AudioClips, with the additional
|
||||||
|
* information of when and how each audio clip is played inside
|
||||||
|
* the playlist.
|
||||||
|
*
|
||||||
|
* @author $Author: maroy $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
*/
|
||||||
|
class Playlist : public Configurable
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The name of the configuration XML elmenent used by Playlist.
|
||||||
|
*/
|
||||||
|
static const std::string configElementNameStr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The unique id of the playlist.
|
||||||
|
*/
|
||||||
|
Ptr<UniqueId>::Ref id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The playling length of the playlist.
|
||||||
|
*/
|
||||||
|
Ptr<time_duration>::Ref playlength;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Default constructor.
|
||||||
|
*/
|
||||||
|
Playlist(void) throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a playlist by specifying all details.
|
||||||
|
* This is used for testing purposes.
|
||||||
|
*
|
||||||
|
* @param id the id of the playlist.
|
||||||
|
* @param playlength the playing length of the playlist.
|
||||||
|
*/
|
||||||
|
Playlist(Ptr<UniqueId>::Ref id,
|
||||||
|
Ptr<time_duration>::Ref playlength) throw ()
|
||||||
|
{
|
||||||
|
this->id = id;
|
||||||
|
this->playlength = playlength;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A virtual destructor, as this class has virtual functions.
|
||||||
|
*/
|
||||||
|
virtual
|
||||||
|
~Playlist(void) throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the name of the XML element this object expects
|
||||||
|
* to be sent to a call to configure().
|
||||||
|
*
|
||||||
|
* @return the name of the expected XML configuration element.
|
||||||
|
*/
|
||||||
|
static const std::string
|
||||||
|
getConfigElementName(void) throw ()
|
||||||
|
{
|
||||||
|
return configElementNameStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure the object based on the XML element supplied.
|
||||||
|
* The supplied element is expected to be of the name
|
||||||
|
* returned by configElementName().
|
||||||
|
*
|
||||||
|
* @param element the XML element to configure the object from.
|
||||||
|
* @exception std::invalid_argument if the supplied XML element
|
||||||
|
* contains bad configuraiton information
|
||||||
|
* @exception std::logic_error if the object has already
|
||||||
|
* been configured, and can not be reconfigured.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
configure(const xmlpp::Element & element)
|
||||||
|
throw (std::invalid_argument,
|
||||||
|
std::logic_error);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the id of the playlist.
|
||||||
|
*
|
||||||
|
* @return the unique id of the playlist.
|
||||||
|
*/
|
||||||
|
Ptr<const UniqueId>::Ref
|
||||||
|
getId(void) const throw ()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the total playing length for this playlist.
|
||||||
|
*
|
||||||
|
* @return the playling length of this playlist, in milliseconds.
|
||||||
|
*/
|
||||||
|
Ptr<const time_duration>::Ref
|
||||||
|
getPlaylength(void) const throw ()
|
||||||
|
{
|
||||||
|
return playlength;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================= external data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ====================================================== function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Core
|
||||||
|
} // namespace LiveSupport
|
||||||
|
|
||||||
|
#endif // LiveSupport_Core_Playlist_h
|
||||||
|
|
|
@ -0,0 +1,111 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: maroy $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Ptr.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef LiveSupport_Core_Ptr_h
|
||||||
|
#define LiveSupport_Core_Ptr_h
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#error This is a C++ include file
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace Core {
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A placeholder class for holidng typedefs to smart pointers.
|
||||||
|
* This is a workaround, as unfortunately typedfs in themselves may
|
||||||
|
* not be templated. For a discussion on the issue, see
|
||||||
|
* http://www.gotw.ca/gotw/079.htm
|
||||||
|
*
|
||||||
|
* The smart pointers here are typedefs to different configurations
|
||||||
|
* of the Loki library pointers Andrei Alexandrescu, author of the
|
||||||
|
* book Modern C++ Design. For references, see
|
||||||
|
* http://www.moderncppdesign.com/ ,
|
||||||
|
* http://www.informit.com/articles/article.asp?p=25264&redir=1 and
|
||||||
|
* http://sourceforge.net/projects/loki-lib/
|
||||||
|
*
|
||||||
|
* @author $Author: maroy $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
*/
|
||||||
|
template <class T>
|
||||||
|
class Ptr
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* Default constructor.
|
||||||
|
*/
|
||||||
|
Ptr(void) throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* This is actually a typedef to the boost shared_ptr, which
|
||||||
|
* is a reference counting shared smart pointer.
|
||||||
|
* For more on boost::shared_ptr, see
|
||||||
|
* http://www.boost.org/libs/smart_ptr/shared_ptr.htm
|
||||||
|
*
|
||||||
|
* To use this pointer, define as follows:
|
||||||
|
* <code>
|
||||||
|
* Ptr<MyType>::Ref myPointer;
|
||||||
|
* </code>
|
||||||
|
*/
|
||||||
|
typedef boost::shared_ptr<T> Ref;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================= external data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ====================================================== function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Core
|
||||||
|
} // namespace LiveSupport
|
||||||
|
|
||||||
|
#endif // LiveSupport_Core_Ptr_h
|
||||||
|
|
|
@ -0,0 +1,105 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: maroy $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Attic/StorageClientInterface.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef LiveSupport_Core_StorageClientInterface_h
|
||||||
|
#define LiveSupport_Core_StorageClientInterface_h
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#error This is a C++ include file
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/UniqueId.h"
|
||||||
|
#include "LiveSupport/Core/Playlist.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace Core {
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An interface for storage clients.
|
||||||
|
*
|
||||||
|
* @author $Author: maroy $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
*/
|
||||||
|
class StorageClientInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Tell if a playlist with a given id exists.
|
||||||
|
*
|
||||||
|
* @param id the id of the playlist to check for.
|
||||||
|
* @return true if a playlist with the specified id exists,
|
||||||
|
* false otherwise.
|
||||||
|
*/
|
||||||
|
virtual const bool
|
||||||
|
existsPlaylist(Ptr<const UniqueId>::Ref id) const throw ()
|
||||||
|
= 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a playlist with the specified id.
|
||||||
|
*
|
||||||
|
* @param id the id of the playlist to return.
|
||||||
|
* @return the requested playlist.
|
||||||
|
* @exception std::invalid_argument if no playlist with the specified
|
||||||
|
* id exists.
|
||||||
|
*/
|
||||||
|
virtual Ptr<Playlist>::Ref
|
||||||
|
getPlaylist(Ptr<const UniqueId>::Ref id) const
|
||||||
|
throw (std::invalid_argument)
|
||||||
|
= 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================= external data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ====================================================== function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Core
|
||||||
|
} // namespace LiveSupport
|
||||||
|
|
||||||
|
#endif // LiveSupport_Core_StorageClientInterface_h
|
||||||
|
|
|
@ -0,0 +1,138 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: maroy $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/UniqueId.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef LiveSupport_Core_UniqueId_h
|
||||||
|
#define LiveSupport_Core_UniqueId_h
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#error This is a C++ include file
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/Ptr.h"
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace Core {
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class representing globally unique identifiers.
|
||||||
|
*
|
||||||
|
* @author $Author: maroy $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
*/
|
||||||
|
class UniqueId
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The value of the id.
|
||||||
|
*/
|
||||||
|
unsigned long int id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor.
|
||||||
|
*/
|
||||||
|
UniqueId(void) throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* The type for the numeric value the unique id is represented in.
|
||||||
|
*/
|
||||||
|
typedef unsigned long int IdType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor to create a UniqueId with a specific value.
|
||||||
|
* TODO: remove this later, as this is for testing purposes only.
|
||||||
|
*
|
||||||
|
* @param id the value of the created id object.
|
||||||
|
*/
|
||||||
|
UniqueId(const IdType id) throw ()
|
||||||
|
{
|
||||||
|
this->id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare this id with an other one.
|
||||||
|
*
|
||||||
|
* @param otherId the other unique id to compare to.
|
||||||
|
* @return true if this id is smaller than the other one,
|
||||||
|
* false otherwise.
|
||||||
|
*/
|
||||||
|
bool
|
||||||
|
operator<(const UniqueId & otherId) const throw ()
|
||||||
|
{
|
||||||
|
return this->id < otherId.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a globally unique id.
|
||||||
|
*/
|
||||||
|
static Ptr<UniqueId>::Ref
|
||||||
|
generateId(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the numeric value of this globally unique id.
|
||||||
|
*
|
||||||
|
* @return the numeric value of this id.
|
||||||
|
*/
|
||||||
|
const IdType
|
||||||
|
getId(void) const throw ()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================= external data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ====================================================== function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Core
|
||||||
|
} // namespace LiveSupport
|
||||||
|
|
||||||
|
#endif // LiveSupport_Core_UniqueId_h
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
keep me
|
|
@ -0,0 +1,105 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: maroy $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/Playlist.h"
|
||||||
|
|
||||||
|
using namespace boost::posix_time;
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* The name of the config element for this class
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
const std::string Playlist::configElementNameStr = "playlist";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the attribute to get the id of the playlist.
|
||||||
|
*/
|
||||||
|
static const std::string idAttrName = "id";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the attribute to get the playlength of the playlist.
|
||||||
|
*/
|
||||||
|
static const std::string playlengthAttrName = "playlength";
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Create a playlist object based on an XML element.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
Playlist :: configure(const xmlpp::Element & element)
|
||||||
|
throw (std::logic_error,
|
||||||
|
std::invalid_argument)
|
||||||
|
{
|
||||||
|
if (element.get_name() != configElementNameStr) {
|
||||||
|
std::string eMsg = "Bad configuration element ";
|
||||||
|
eMsg += element.get_name();
|
||||||
|
throw std::invalid_argument(eMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
const xmlpp::Attribute * attribute;
|
||||||
|
std::stringstream strStr;
|
||||||
|
unsigned long int idValue;
|
||||||
|
|
||||||
|
if (!(attribute = element.get_attribute(idAttrName))) {
|
||||||
|
std::string eMsg = "Missing attribute ";
|
||||||
|
eMsg += idAttrName;
|
||||||
|
throw std::invalid_argument(eMsg);
|
||||||
|
}
|
||||||
|
strStr.str(attribute->get_value());
|
||||||
|
strStr >> idValue;
|
||||||
|
id.reset(new UniqueId(idValue));
|
||||||
|
|
||||||
|
if (!(attribute = element.get_attribute(playlengthAttrName))) {
|
||||||
|
std::string eMsg = "Missing attribute ";
|
||||||
|
eMsg += idAttrName;
|
||||||
|
throw std::invalid_argument(eMsg);
|
||||||
|
}
|
||||||
|
playlength.reset(new time_duration(
|
||||||
|
duration_from_string(attribute->get_value())));
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,116 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: maroy $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistTest.cxx,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#else
|
||||||
|
#error "Need unistd.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/Playlist.h"
|
||||||
|
#include "PlaylistTest.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
CPPUNIT_TEST_SUITE_REGISTRATION(PlaylistTest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the configuration file for the playlist.
|
||||||
|
*/
|
||||||
|
static const std::string configFileName = "etc/playlist.xml";
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Set up the test environment
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
PlaylistTest :: setUp(void) throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Clean up the test environment
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
PlaylistTest :: tearDown(void) throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Test to see if the singleton Hello object is accessible
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
PlaylistTest :: firstTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Ptr<xmlpp::DomParser>::Ref parser(
|
||||||
|
new xmlpp::DomParser(configFileName, true));
|
||||||
|
const xmlpp::Document * document = parser->get_document();
|
||||||
|
const xmlpp::Element * root = document->get_root_node();
|
||||||
|
Ptr<Playlist>::Ref playlist(new Playlist());
|
||||||
|
|
||||||
|
playlist->configure(*root);
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT(playlist->getId()->getId() == 1);
|
||||||
|
Ptr<const boost::posix_time::time_duration>::Ref duration
|
||||||
|
= playlist->getPlaylength();
|
||||||
|
CPPUNIT_ASSERT(duration->hours() == 1);
|
||||||
|
CPPUNIT_ASSERT(duration->minutes() == 30);
|
||||||
|
CPPUNIT_ASSERT(duration->seconds() == 0);
|
||||||
|
} catch (std::invalid_argument &e) {
|
||||||
|
CPPUNIT_FAIL("semantic error in configuration file");
|
||||||
|
} catch (xmlpp::exception &e) {
|
||||||
|
CPPUNIT_FAIL("error parsing configuration file");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,106 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: maroy $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistTest.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef PlaylistTest_h
|
||||||
|
#define PlaylistTest_h
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#error This is a C++ include file
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <cppunit/extensions/HelperMacros.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace Core {
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test for the UploadPlaylistMetohd class.
|
||||||
|
*
|
||||||
|
* @author $Author: maroy $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
* @see Playlist
|
||||||
|
*/
|
||||||
|
class PlaylistTest : public CPPUNIT_NS::TestFixture
|
||||||
|
{
|
||||||
|
CPPUNIT_TEST_SUITE(PlaylistTest);
|
||||||
|
CPPUNIT_TEST(firstTest);
|
||||||
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple test.
|
||||||
|
*
|
||||||
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
firstTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set up the environment for the test case.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
setUp(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean up the environment after the test case.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
tearDown(void) throw ();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================= external data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ====================================================== function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Core
|
||||||
|
} // namespace LiveSupport
|
||||||
|
|
||||||
|
#endif // PlaylistTest_h
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: maroy $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/TestRunner.cxx,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <cppunit/BriefTestProgressListener.h>
|
||||||
|
#include <cppunit/CompilerOutputter.h>
|
||||||
|
#include <cppunit/extensions/TestFactoryRegistry.h>
|
||||||
|
#include <cppunit/TestResult.h>
|
||||||
|
#include <cppunit/TestResultCollector.h>
|
||||||
|
#include <cppunit/TestRunner.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Run all tests
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
int
|
||||||
|
main( int argc,
|
||||||
|
char * argv[] ) throw ()
|
||||||
|
{
|
||||||
|
// Create the event manager and test controller
|
||||||
|
CPPUNIT_NS::TestResult controller;
|
||||||
|
|
||||||
|
// Add a listener that colllects test result
|
||||||
|
CPPUNIT_NS::TestResultCollector result;
|
||||||
|
controller.addListener( &result );
|
||||||
|
|
||||||
|
// Add a listener that print dots as test run.
|
||||||
|
CPPUNIT_NS::BriefTestProgressListener progress;
|
||||||
|
controller.addListener( &progress );
|
||||||
|
|
||||||
|
// Add the top suite to the test runner
|
||||||
|
CPPUNIT_NS::TestRunner runner;
|
||||||
|
runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
|
||||||
|
runner.run( controller );
|
||||||
|
|
||||||
|
// Print test in a compiler compatible format.
|
||||||
|
CPPUNIT_NS::CompilerOutputter outputter( &result, std::cerr );
|
||||||
|
outputter.setLocationFormat("%p:%l:");
|
||||||
|
outputter.write();
|
||||||
|
|
||||||
|
return result.wasSuccessful() ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: maroy $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/UniqueId.cxx,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/UniqueId.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Generate a globally unique id.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
Ptr<UniqueId>::Ref
|
||||||
|
UniqueId :: generateId(void) throw ()
|
||||||
|
{
|
||||||
|
// TODO: implement this properly, e.g. use a GUID pattern
|
||||||
|
// one example is the algorithm found in xdoclet for GUID
|
||||||
|
|
||||||
|
Ptr<UniqueId>::Ref id(new UniqueId());
|
||||||
|
id->id = rand();
|
||||||
|
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
keep me
|
Loading…
Reference in New Issue