Permalink
Browse files

Deleted more cruft. Added a method to JSObjectScriptManager to create

a headless session of JSObjectScript.
  • Loading branch information...
1 parent fb78878 commit ab417def64fb569336be52b7fb57ba6b657cc8dd @bmistree bmistree committed Jun 3, 2011
@@ -59,93 +59,6 @@ namespace Sirikata {
namespace JS {
-// //
-// public SessionEventListener,
-// public JSVisibleStructMonitor
-
-// JSObjectScript(HostedObjectPtr ho, const String& args, JSObjectScriptManager* jMan);
-// // SessionEventListener Interface
-// virtual void onConnected(SessionEventProviderPtr from, const SpaceObjectReference& name,HostedObject::PresenceToken token);
-// virtual void onDisconnected(SessionEventProviderPtr from, const SpaceObjectReference& name);
-// //called by JSPresenceStruct. requests the parent HostedObject disconnect
-// //the presence associated with jspres
-// void requestDisconnect(JSPresenceStruct* jspres);
-
-// void processMessage(const ODP::Endpoint& src, const ODP::Endpoint& dst, MemoryReference bodyData);
-
-// virtual void notifyProximateGone(ProxyObjectPtr proximateObject, const SpaceObjectReference& querier);
-// virtual void notifyProximate(ProxyObjectPtr proximateObject, const SpaceObjectReference& querier);
-
-// v8::Handle<v8::Value> restorePresence(PresStructRestoreParams& psrp,JSContextStruct* jsctx);
-
-// /**
-// This function runs through the entire list of presences associated with
-// this JSObjectScript, and then frees those that are not part of that vector.
-// */
-// void killOtherPresences(JSPresVec& jspresVec);
-
-
-// //takes the c++ object jspres, creates a new visible object out of it, if we
-// //don't already have a c++ visible object associated with it (if we do, use
-// //that one), wraps that c++ object in v8, and returns it as a v8 object to
-// //user
-// v8::Persistent<v8::Object> presToVis(JSPresenceStruct* jspres, JSContextStruct* jscont);
-
-// void registerFixupSuspendable(JSSuspendable* jssuspendable, uint32 contID);
-
-// /** create a new entity at the run time */
-// void create_entity(EntityCreateInfo& eci);
-
-// //handling basic datatypes for JSPresences
-// void setVisualFunction(const SpaceObjectReference* sporef, const std::string& newMeshString);
-// void setPositionFunction(const SpaceObjectReference* sporef, const Vector3f& posVec);
-// void setVelocityFunction(const SpaceObjectReference* sporef, const Vector3f& velVec);
-// void setOrientationFunction(const SpaceObjectReference* sporef, const Quaternion& quat);
-// void setVisualScaleFunction(const SpaceObjectReference* sporef, float newScale);
-// void setOrientationVelFunction(const SpaceObjectReference* sporef, const Quaternion& quat);
-// void setQueryAngleFunction(const SpaceObjectReference* sporef, const SolidAngle& sa);
-
-// v8::Handle<v8::Value> getPhysicsFunction(const SpaceObjectReference* sporef);
-// void setPhysicsFunction(const SpaceObjectReference* sporef, const String& newPhysicsString);
-
-// /****Methods that return V8 wrappers for c++ objects **/
-// //attempts to make a new jsvisiblestruct if don't already have one in
-// //jsvismonitor matching visibleObj+visibleTo. Wraps the c++ jsvisiblestruct
-// //in v8 object.
-// v8::Local<v8::Object> createVisibleObject(const SpaceObjectReference& visibleObj,const SpaceObjectReference& visibleTo,VisAddParams* addParams, v8::Handle<v8::Context> ctx);
-// v8::Persistent<v8::Object> createVisiblePersistent(const SpaceObjectReference& visibleObj,VisAddParams* addParams, v8::Handle<v8::Context> ctx);
-
-
-// v8::Handle<v8::Value> findVisible(const SpaceObjectReference& proximateObj);
-
-
-// //wraps the c++ presence structure in a v8 object.
-// v8::Local<v8::Object> wrapPresence(JSPresenceStruct* presToWrap, v8::Persistent<v8::Context>* ctxToWrapIn);
-
-// /** create a new presence of this entity */
-// v8::Handle<v8::Value> create_presence(const String& newMesh, v8::Handle<v8::Function> callback, JSContextStruct* jsctx, const Vector3d& poser, const SpaceID& spaceToCreateIn);
-
-
-// Sirikata::JS::JSInvokableObject::JSInvokableObjectInt* runSimulation(const SpaceObjectReference& sporef, const String& simname);
-
-// v8::Handle<v8::Value> requestReset(JSContextStruct* jscont);
-
-
-
-// //registering position listeners to receive updates from loc
-// bool registerPosAndMeshListener(SpaceObjectReference* sporef, SpaceObjectReference* ownPres,PositionListener* pl,MeshListener*ml, TimedMotionVector3f* loc, TimedMotionQuaternion* orient, BoundingSphere3f* bs, String* mesh, String* phy);
-// bool deRegisterPosAndMeshListener(SpaceObjectReference* sporef, SpaceObjectReference* ownPres,PositionListener* pl,MeshListener* ml);
-
-
-// /** Register an event pattern matcher and handler. */
-// void registerHandler(JSEventHandlerStruct* jsehs);
-// v8::Handle<v8::Object> makeEventHandlerObject(JSEventHandlerStruct* evHand, JSContextStruct* jscs);
-
-// void deleteHandler(JSEventHandlerStruct* toDelete);
-
-// void resetPresence(JSPresenceStruct* jspresStruct);
-
-// //
class JSObjectScript : public ObjectScript
{
@@ -431,6 +431,15 @@ JSObjectScriptManager::~JSObjectScriptManager()
{
}
+
+
+JSObjectScript* JSObjectScriptManager::createHeadless(const String& args)
+{
+ JSObjectScript* new_script = new JSObjectScript(this);
+ new_script->initialize(args);
+ return new_script;
+}
+
ObjectScript* JSObjectScriptManager::createObjectScript(HostedObjectPtr ho, const String& args)
{
EmersonScript* new_script = new EmersonScript(ho, args, this);
@@ -39,9 +39,13 @@
#include <v8.h>
+
+
namespace Sirikata {
namespace JS {
+class JSObjectScript;
+
class JSObjectScriptManager : public ObjectScriptManager {
public:
static ObjectScriptManager* createObjectScriptManager(const Sirikata::String& arguments);
@@ -52,6 +56,8 @@ class JSObjectScriptManager : public ObjectScriptManager {
virtual ObjectScript* createObjectScript(HostedObjectPtr ho, const String& args);
virtual void destroyObjectScript(ObjectScript* toDestroy);
+ JSObjectScript* createHeadless(const String& args);
+
OptionSet* getOptions() const { return mOptions; }
String defaultScript() const;

0 comments on commit ab417de

Please sign in to comment.