rewrote acquire/release methods in TestStorageClient

This commit is contained in:
fgerlits 2004-11-09 16:05:44 +00:00
parent 3da6eaa61f
commit 0e0d7335a1
4 changed files with 66 additions and 24 deletions

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.4 $
Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h,v $
------------------------------------------------------------------------------*/
@ -72,7 +72,7 @@ using namespace boost::posix_time;
* in a Playlist.
*
* @author $Author: fgerlits $
* @version $Revision: 1.4 $
* @version $Revision: 1.5 $
*/
class AudioClip : public Configurable
{
@ -115,7 +115,8 @@ class AudioClip : public Configurable
*/
AudioClip(Ptr<UniqueId>::Ref id,
Ptr<time_duration>::Ref playlength,
Ptr<string>::Ref uri = Ptr<string>::Ref()) throw ()
Ptr<string>::Ref uri = Ptr<string>::Ref())
throw ()
{
this->id = id;
this->playlength = playlength;
@ -188,6 +189,16 @@ class AudioClip : public Configurable
return uri;
}
/**
* Change the URI of this audio clip. This is only used in testing.
*
* @return the URI of this audio clip.
*/
void
setUri(Ptr<string>::Ref uri) throw ()
{
this->uri = uri;
}
};

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.12 $
Version : $Revision: 1.13 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Playlist.h,v $
------------------------------------------------------------------------------*/
@ -71,7 +71,7 @@ using namespace boost::posix_time;
* the playlist.
*
* @author $Author: fgerlits $
* @version $Revision: 1.12 $
* @version $Revision: 1.13 $
*/
class Playlist : public Configurable
{
@ -91,6 +91,11 @@ class Playlist : public Configurable
*/
Ptr<time_duration>::Ref playlength;
/**
* The uri of the SMIL file generated from this playlist (if any).
*/
Ptr<std::string>::Ref uri;
/**
* Flag set if playlist is currently playing.
*/
@ -136,6 +141,7 @@ class Playlist : public Configurable
*/
Playlist(void) throw ()
{
elementList.reset(new PlaylistElementListType);
this->isLockedForPlaying = false;
this->isLockedForEditing = false;
}
@ -148,10 +154,14 @@ class Playlist : public Configurable
* @param playlength the playing length of the playlist.
*/
Playlist(Ptr<UniqueId>::Ref id,
Ptr<time_duration>::Ref playlength) throw ()
Ptr<time_duration>::Ref playlength,
Ptr<std::string>::Ref uri = Ptr<std::string>::Ref())
throw ()
{
this->id = id;
this->playlength = playlength;
this->uri = uri;
elementList.reset(new PlaylistElementListType);
this->isLockedForPlaying = false;
this->isLockedForEditing = false;
}
@ -211,6 +221,27 @@ class Playlist : public Configurable
return playlength;
}
/**
* Return the uri of the playlist.
*
* @return the uri of the playlist.
*/
Ptr<const std::string>::Ref
getUri(void) const throw ()
{
return uri;
}
/**
* Set the uri of the playlist.
*
*/
void
setUri(Ptr<std::string>::Ref uri) throw ()
{
this->uri = uri;
}
/**
* Test whether the playlist is locked for editing or playing.
*

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.10 $
Version : $Revision: 1.11 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Attic/StorageClientInterface.h,v $
------------------------------------------------------------------------------*/
@ -61,7 +61,7 @@ namespace Core {
* An interface for storage clients.
*
* @author $Author: fgerlits $
* @version $Revision: 1.10 $
* @version $Revision: 1.11 $
*/
class StorageClientInterface
{
@ -94,12 +94,13 @@ class StorageClientInterface
* Acquire the resources for the playlist.
*
* @param id the id of the playlist to acquire.
* @return a path (in the local storage) to the Playlist SMIL
* temp file.
* @return a new Playlist instance containing a uri field which
* points to an executable (playable) SMIL representation of
* the playlist (in the local storage).
* @exception std::invalid_argument if no playlist with the specified
* specified id exists.
*/
virtual Ptr<std::string>::Ref
virtual Ptr<Playlist>::Ref
acquirePlaylist(Ptr<const UniqueId>::Ref id) const
throw (std::logic_error)
= 0;
@ -108,12 +109,12 @@ class StorageClientInterface
* Release the resources (audio clips, other playlists) used
* in a playlist.
*
* @param id the id of the playlist to release.
* @exception std::invalid_argument if no playlist with the specified
* specified id exists.
* @param playlist the playlist to release.
* @exception std::logic_error if the playlist has no uri field,
* or the file does not exist, etc.
*/
virtual void
releasePlaylist(Ptr<const UniqueId>::Ref id) const
releasePlaylist(Ptr<const Playlist>::Ref playlist) const
throw (std::logic_error)
= 0;
/**
@ -172,24 +173,25 @@ class StorageClientInterface
* Acquire the resources for the audio clip with the specified id.
*
* @param id the id of the audio clip to acquire.
* @return a URI to the audio clip.
* @return a new AudioClip instance, containing a uri field which
* points to (a way of getting) the sound file.
* @exception std::invalid_argument if no audio clip with the
* specified id exists.
*/
virtual Ptr<std::string>::Ref
virtual Ptr<AudioClip>::Ref
acquireAudioClip(Ptr<const UniqueId>::Ref id) const
throw (std::logic_error)
= 0;
/**
* Release the lock on an audio clip with the specified id.
* Release the resource (sound file) used by an audio clip.
*
* @param id the id of the audio clip to release.
* @exception std::invalid_argument if no audio clip with the
* specified id exists.
* @exception std::logic_error if the audio clip has no uri field,
* or the file does not exist, etc.
*/
virtual void
releaseAudioClip(Ptr<const UniqueId>::Ref id) const
releaseAudioClip(Ptr<const AudioClip>::Ref audioClip) const
throw (std::logic_error)
= 0;

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.11 $
Version : $Revision: 1.12 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $
------------------------------------------------------------------------------*/
@ -158,7 +158,6 @@ Playlist :: configure(const xmlpp::Element & element)
playlength.reset(new time_duration(
duration_from_string(attribute->get_value())));
elementList.reset(new PlaylistElementListType);
xmlpp::Node::NodeList childNodes
= element.get_children(elementListAttrName);
xmlpp::Node::NodeList::iterator it = childNodes.begin();
@ -212,7 +211,6 @@ Playlist::addAudioClip(Ptr<AudioClip>::Ref audioClip,
Ptr<PlaylistElement>::Ref playlistElement(new PlaylistElement(
relativeOffset, audioClip, fadeInfo));
(*elementList)[*relativeOffset] = playlistElement;
}