better output methods

This commit is contained in:
David Rose 2003-11-29 00:38:36 +00:00
parent 63904c687e
commit 6dfe2d4a49
5 changed files with 51 additions and 17 deletions

View File

@ -362,6 +362,18 @@ get_part() const {
return DCAST(PartBundle, _part);
}
////////////////////////////////////////////////////////////////////
// Function: AnimControl::output
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
void AnimControl::
output(ostream &out) const {
out << "AnimControl(" << get_part()->get_name()
<< ", " << get_anim()->get_name() << ")";
}
////////////////////////////////////////////////////////////////////
// Function: AnimControl::advance_time
@ -457,18 +469,6 @@ mark_channels() {
_marked_frame = get_frame();
}
////////////////////////////////////////////////////////////////////
// Function: AnimControl::output
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
void AnimControl::
output(ostream &out) const {
out << "AnimControl(" << get_part()->get_name()
<< ", " << get_anim()->get_name() << ")";
}
////////////////////////////////////////////////////////////////////
// Function: AnimControl::insert_event_action

View File

@ -74,6 +74,8 @@ PUBLISHED:
PartBundle *get_part() const;
INLINE AnimBundle *get_anim() const;
void output(ostream &out) const;
public:
// The following functions aren't really part of the public
// interface; they're just public so we don't have to declare a
@ -86,8 +88,6 @@ public:
INLINE int get_channel_index() const;
void output(ostream &out) const;
private:
enum ActionType {

View File

@ -239,3 +239,10 @@ get_num_frames(const string &anim_name) const {
}
return control->get_num_frames();
}
INLINE ostream &
operator << (ostream &out, const AnimControlCollection &collection) {
collection.output(out);
return out;
}

View File

@ -229,3 +229,26 @@ which_anim_playing() const {
return result;
}
////////////////////////////////////////////////////////////////////
// Function: AnimControlCollection::output
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
void AnimControlCollection::
output(ostream &out) const {
out << _controls.size() << " anims.";
}
////////////////////////////////////////////////////////////////////
// Function: AnimControlCollection::write
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
void AnimControlCollection::
write(ostream &out) const {
Controls::const_iterator ci;
for (ci = _controls.begin(); ci != _controls.end(); ++ci) {
out << (*ci).first << ": " << *(*ci).second << "\n";
}
}

View File

@ -23,10 +23,9 @@
#include "animControl.h"
#include <event.h>
#include <pt_Event.h>
#include "event.h"
#include "pt_Event.h"
#include <string>
#include "pmap.h"
////////////////////////////////////////////////////////////////////
@ -84,6 +83,9 @@ PUBLISHED:
string which_anim_playing() const;
void output(ostream &out) const;
void write(ostream &out) const;
private:
typedef pmap<string, PT(AnimControl) > Controls;
Controls _controls;
@ -91,6 +93,8 @@ private:
AnimControl *_last_started_control;
};
INLINE ostream &operator << (ostream &out, const AnimControlCollection &collection);
#include "animControlCollection.I"
#endif