From 12bf23e4c869153e1ed409d2d5630b0b735acd49 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 17 May 2013 12:14:44 -0700 Subject: [PATCH 1/9] disallow Agent copying --- libraries/shared/src/Agent.cpp | 61 -------------------------------- libraries/shared/src/Agent.h | 7 ++-- libraries/shared/src/AgentData.h | 7 ++-- 3 files changed, 7 insertions(+), 68 deletions(-) diff --git a/libraries/shared/src/Agent.cpp b/libraries/shared/src/Agent.cpp index db4170515a..f79e5702df 100644 --- a/libraries/shared/src/Agent.cpp +++ b/libraries/shared/src/Agent.cpp @@ -55,67 +55,6 @@ Agent::Agent(sockaddr* publicSocket, sockaddr* localSocket, char type, uint16_t } } -Agent::Agent(const Agent &otherAgent) : - _type(otherAgent._type), - _agentID(otherAgent._agentID), - _wakeMicrostamp(otherAgent._wakeMicrostamp), - _lastHeardMicrostamp(otherAgent._lastHeardMicrostamp), - _isAlive(otherAgent._isAlive) -{ - if (otherAgent._publicSocket) { - _publicSocket = new sockaddr(*otherAgent._localSocket); - } else { - _publicSocket = NULL; - } - - if (otherAgent._localSocket) { - _localSocket = new sockaddr(*otherAgent._localSocket); - } else { - _localSocket = NULL; - } - - if (otherAgent._activeSocket == otherAgent._publicSocket) { - _activeSocket = _publicSocket; - } else if (otherAgent._activeSocket == otherAgent._localSocket) { - _activeSocket = _localSocket; - } else { - _activeSocket = NULL; - } - - if (otherAgent._linkedData) { - _linkedData = otherAgent._linkedData->clone(); - } else { - _linkedData = NULL; - } - - if (otherAgent._bytesReceivedMovingAverage != NULL) { - _bytesReceivedMovingAverage = new SimpleMovingAverage(100); - memcpy(_bytesReceivedMovingAverage, otherAgent._bytesReceivedMovingAverage, sizeof(SimpleMovingAverage)); - } else { - _bytesReceivedMovingAverage = NULL; - } -} - -Agent& Agent::operator=(Agent otherAgent) { - swap(*this, otherAgent); - return *this; -} - -void Agent::swap(Agent &first, Agent &second) { - using std::swap; - - swap(first._isAlive, second._isAlive); - swap(first._publicSocket, second._publicSocket); - swap(first._localSocket, second._localSocket); - swap(first._activeSocket, second._activeSocket); - swap(first._type, second._type); - swap(first._linkedData, second._linkedData); - swap(first._agentID, second._agentID); - swap(first._wakeMicrostamp, second._wakeMicrostamp); - swap(first._lastHeardMicrostamp, second._lastHeardMicrostamp); - swap(first._bytesReceivedMovingAverage, second._bytesReceivedMovingAverage); -} - Agent::~Agent() { delete _publicSocket; delete _localSocket; diff --git a/libraries/shared/src/Agent.h b/libraries/shared/src/Agent.h index 55ef67c8e5..5201fd9048 100644 --- a/libraries/shared/src/Agent.h +++ b/libraries/shared/src/Agent.h @@ -24,9 +24,8 @@ class Agent { public: Agent(sockaddr* publicSocket, sockaddr* localSocket, char type, uint16_t agentID); - Agent(const Agent &otherAgent); ~Agent(); - Agent& operator=(Agent otherAgent); + bool operator==(const Agent& otherAgent); bool matches(sockaddr* otherPublicSocket, sockaddr* otherLocalSocket, char otherAgentType); @@ -66,7 +65,9 @@ public: static void printLog(Agent const&); private: - void swap(Agent &first, Agent &second); + // privatize copy and assignment operator to disallow Agent copying + Agent(const Agent &otherAgent); + Agent& operator=(Agent otherAgent); char _type; uint16_t _agentID; diff --git a/libraries/shared/src/AgentData.h b/libraries/shared/src/AgentData.h index f8bef16b41..342f501a1e 100644 --- a/libraries/shared/src/AgentData.h +++ b/libraries/shared/src/AgentData.h @@ -10,10 +10,9 @@ #define hifi_AgentData_h class AgentData { - public: - virtual ~AgentData() = 0; - virtual int parseData(unsigned char* sourceBuffer, int numBytes) = 0; - virtual AgentData* clone() const = 0; +public: + virtual ~AgentData() = 0; + virtual int parseData(unsigned char* sourceBuffer, int numBytes) = 0; }; #endif From 199853711fb0cb854fe39f8f23557d95f1b22872 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 17 May 2013 12:15:10 -0700 Subject: [PATCH 2/9] disallow copying of AvatarData objects --- libraries/avatars/src/AvatarData.cpp | 8 -------- libraries/avatars/src/AvatarData.h | 9 ++++----- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index ab60088cf8..9333c3ce50 100644 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -34,14 +34,6 @@ int unpackFloatAngleFromTwoByte(uint16_t* byteAnglePointer, float* destinationPo return sizeof(uint16_t); } -AvatarData::~AvatarData() { - -} - -AvatarData* AvatarData::clone() const { - return new AvatarData(*this); -} - int AvatarData::getBroadcastData(unsigned char* destinationBuffer) { unsigned char* bufferStart = destinationBuffer; diff --git a/libraries/avatars/src/AvatarData.h b/libraries/avatars/src/AvatarData.h index f131f82c85..413f5afcf1 100644 --- a/libraries/avatars/src/AvatarData.h +++ b/libraries/avatars/src/AvatarData.h @@ -52,11 +52,6 @@ public: _wantResIn(false), _wantColor(true) { }; - - ~AvatarData(); - - AvatarData* clone() const; - const glm::vec3& getPosition() const; void setPosition(glm::vec3 position); void setHandPosition(glm::vec3 handPosition); @@ -134,6 +129,10 @@ public: void setWantDelta(bool wantDelta) { _wantDelta = wantDelta; } protected: + // privatize the copy constructor and assignment operator so they cannot be called + AvatarData(const AvatarData&); + AvatarData& operator= (const AvatarData&); + glm::vec3 _position; glm::vec3 _handPosition; From 1ba1b56b2c406a03828b6b79d79529f9eb53a712 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 17 May 2013 12:15:19 -0700 Subject: [PATCH 3/9] disallow copying of Avatar objects --- interface/src/Avatar.cpp | 62 ---------------------------------------- interface/src/Avatar.h | 7 +++-- 2 files changed, 4 insertions(+), 65 deletions(-) diff --git a/interface/src/Avatar.cpp b/interface/src/Avatar.cpp index 954a4a38bc..704deaf9fe 100644 --- a/interface/src/Avatar.cpp +++ b/interface/src/Avatar.cpp @@ -58,7 +58,6 @@ bool usingBigSphereCollisionTest = true; float chatMessageScale = 0.0015; float chatMessageHeight = 0.45; - Avatar::Avatar(bool isMine) { _orientation.setToIdentity(); @@ -107,49 +106,6 @@ Avatar::Avatar(bool isMine) { else { _balls = NULL; } } -Avatar::Avatar(const Avatar &otherAvatar) : _head(otherAvatar._head) { //include the copy constructor for head - - _velocity = otherAvatar._velocity; - _thrust = otherAvatar._thrust; - _rotation = otherAvatar._rotation; - _bodyYaw = otherAvatar._bodyYaw; - _bodyPitch = otherAvatar._bodyPitch; - _bodyRoll = otherAvatar._bodyRoll; - _bodyPitchDelta = otherAvatar._bodyPitchDelta; - _bodyYawDelta = otherAvatar._bodyYawDelta; - _bodyRollDelta = otherAvatar._bodyRollDelta; - _mousePressed = otherAvatar._mousePressed; - _mode = otherAvatar._mode; - _isMine = otherAvatar._isMine; - _renderYaw = otherAvatar._renderYaw; - _maxArmLength = otherAvatar._maxArmLength; - _transmitterTimer = otherAvatar._transmitterTimer; - _transmitterIsFirstData = otherAvatar._transmitterIsFirstData; - _transmitterTimeLastReceived = otherAvatar._transmitterTimeLastReceived; - _transmitterHz = otherAvatar._transmitterHz; - _transmitterInitialReading = otherAvatar._transmitterInitialReading; - _transmitterPackets = otherAvatar._transmitterPackets; - _isTransmitterV2Connected = otherAvatar._isTransmitterV2Connected; - _TEST_bigSphereRadius = otherAvatar._TEST_bigSphereRadius; - _TEST_bigSpherePosition = otherAvatar._TEST_bigSpherePosition; - _movedHandOffset = otherAvatar._movedHandOffset; - - _orientation.set(otherAvatar._orientation); - - initializeSkeleton(); - - for (int i = 0; i < MAX_DRIVE_KEYS; i++) _driveKeys[i] = otherAvatar._driveKeys[i]; - - _distanceToNearestAvatar = otherAvatar._distanceToNearestAvatar; - - initializeSkeleton(); - -} - -Avatar* Avatar::clone() const { - return new Avatar(*this); -} - void Avatar::reset() { _headPitch = _headYaw = _headRoll = 0; _head.leanForward = _head.leanSideways = 0; @@ -460,8 +416,6 @@ void Avatar::simulate(float deltaTime) { } } - - void Avatar::checkForMouseRayTouching() { for (int b = 0; b < NUM_AVATAR_JOINTS; b++) { @@ -477,13 +431,10 @@ void Avatar::checkForMouseRayTouching() { } } - void Avatar::setMouseRay(const glm::vec3 &origin, const glm::vec3 &direction ) { _mouseRayOrigin = origin; _mouseRayDirection = direction; } - - void Avatar::updateHandMovementAndTouching(float deltaTime) { // reset hand and arm positions according to hand movement @@ -600,12 +551,10 @@ void Avatar::updateHandMovementAndTouching(float deltaTime) { } } - float Avatar::getHeight() { return _height; } - void Avatar::updateCollisionWithSphere(glm::vec3 position, float radius, float deltaTime) { float myBodyApproximateBoundingRadius = 1.0f; glm::vec3 vectorFromMyBodyToBigSphere(_position - position); @@ -644,9 +593,6 @@ void Avatar::updateCollisionWithSphere(glm::vec3 position, float radius, float d } } - - - void Avatar::updateAvatarCollisions(float deltaTime) { // Reset detector for nearest avatar @@ -677,9 +623,6 @@ void Avatar::updateAvatarCollisions(float deltaTime) { } } - - - //detect collisions with other avatars and respond void Avatar::applyCollisionWithOtherAvatar(Avatar * otherAvatar, float deltaTime) { @@ -735,8 +678,6 @@ void Avatar::applyCollisionWithOtherAvatar(Avatar * otherAvatar, float deltaTime otherAvatar->_velocity *= bodyMomentum; } - - void Avatar::setDisplayingHead(bool displayingHead) { _displayingHead = displayingHead; } @@ -1136,9 +1077,6 @@ glm::vec3 Avatar::getApproximateEyePosition() { return _head.getApproximateEyePosition(); } - - - void Avatar::updateArmIKAndConstraints(float deltaTime) { // determine the arm vector diff --git a/interface/src/Avatar.h b/interface/src/Avatar.h index a3f46cc542..303aca66f6 100644 --- a/interface/src/Avatar.h +++ b/interface/src/Avatar.h @@ -76,9 +76,7 @@ enum AvatarJointID class Avatar : public AvatarData { public: Avatar(bool isMine); - Avatar(const Avatar &otherAvatar); - Avatar* clone() const; - + void reset(); void updateHeadFromGyros(float frametime, SerialInterface * serialInterface, glm::vec3 * gravity); void updateFromMouse(int mouseX, int mouseY, int screenWidth, int screenHeight); @@ -139,6 +137,9 @@ public: void readAvatarDataFromFile(); private: + // privatize copy constructor and assignment operator to avoid copying + Avatar(const Avatar&); + Avatar& operator= (const Avatar&); struct AvatarJoint { From fb2f36519d66ca32a9afc6fa15a70c85228ec827 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 17 May 2013 12:19:19 -0700 Subject: [PATCH 4/9] inline getters and setters in AvatarData --- libraries/avatars/src/AvatarData.cpp | 42 +--------------------------- libraries/avatars/src/AvatarData.h | 21 ++++++++------ 2 files changed, 13 insertions(+), 50 deletions(-) diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index 9333c3ce50..f63947a580 100644 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -192,49 +192,9 @@ int AvatarData::parseData(unsigned char* sourceBuffer, int numBytes) { return sourceBuffer - startPosition; } -const glm::vec3& AvatarData::getPosition() const { - return _position; -} - -void AvatarData::setPosition(glm::vec3 position) { - _position = position; -} - -void AvatarData::setHandPosition(glm::vec3 handPosition) { - _handPosition = handPosition; -} - -float AvatarData::getBodyYaw() { - return _bodyYaw; -} - -void AvatarData::setBodyYaw(float bodyYaw) { - _bodyYaw = bodyYaw; -} - -float AvatarData::getBodyPitch() { - return _bodyPitch; -} - -void AvatarData::setBodyPitch(float bodyPitch) { - _bodyPitch = bodyPitch; -} - -float AvatarData::getBodyRoll() { - return _bodyRoll; -} - -void AvatarData::setBodyRoll(float bodyRoll) { - _bodyRoll = bodyRoll; -} - void AvatarData::setHeadPitch(float p) { // Set head pitch and apply limits const float MAX_PITCH = 60; const float MIN_PITCH = -60; _headPitch = glm::clamp(p, MIN_PITCH, MAX_PITCH); -} - - - - +} \ No newline at end of file diff --git a/libraries/avatars/src/AvatarData.h b/libraries/avatars/src/AvatarData.h index 413f5afcf1..f37c4f3396 100644 --- a/libraries/avatars/src/AvatarData.h +++ b/libraries/avatars/src/AvatarData.h @@ -52,20 +52,23 @@ public: _wantResIn(false), _wantColor(true) { }; - const glm::vec3& getPosition() const; - void setPosition(glm::vec3 position); - void setHandPosition(glm::vec3 handPosition); + const glm::vec3& getPosition() const { return _position; } + void setPosition(const glm::vec3 position) { _position = position; } + + void setHandPosition(const glm::vec3 handPosition) { _handPosition = handPosition; } int getBroadcastData(unsigned char* destinationBuffer); int parseData(unsigned char* sourceBuffer, int numBytes); // Body Rotation - float getBodyYaw(); - float getBodyPitch(); - float getBodyRoll(); - void setBodyYaw(float bodyYaw); - void setBodyPitch(float bodyPitch); - void setBodyRoll(float bodyRoll); + float getBodyYaw() const { return _bodyYaw; } + void setBodyYaw(float bodyYaw) { _bodyYaw = bodyYaw; } + + float getBodyPitch() const { return _bodyPitch; } + void setBodyPitch(float bodyPitch) { _bodyPitch = bodyPitch; } + + float getBodyRoll() const {return _bodyRoll; } + void setBodyRoll(float bodyRoll) { _bodyRoll = bodyRoll; } // Head Rotation void setHeadPitch(float p); From 3e65d5a548950f4c2bfd89745f69cee4f34e2a4c Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 17 May 2013 12:25:00 -0700 Subject: [PATCH 5/9] inline getters and setters in Avatar --- interface/src/Application.cpp | 4 ++-- interface/src/Avatar.cpp | 21 +-------------------- interface/src/Avatar.h | 8 ++++---- 3 files changed, 7 insertions(+), 26 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 8b1e264c4b..cd5451c9fd 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -786,14 +786,14 @@ void Application::idle() { if (_myAvatar.isTransmitterV2Connected()) { const float HAND_FORCE_SCALING = 0.05f; const float* handAcceleration = _myAvatar.getTransmitterHandLastAcceleration(); - _myAvatar.setHandMovementValues(glm::vec3(-handAcceleration[0] * HAND_FORCE_SCALING, + _myAvatar.setMovedHandOffset(glm::vec3(-handAcceleration[0] * HAND_FORCE_SCALING, handAcceleration[1] * HAND_FORCE_SCALING, handAcceleration[2] * HAND_FORCE_SCALING)); } else { // update behaviors for avatar hand movement: handControl takes mouse values as input, // and gives back 3D values modulated for smooth transitioning between interaction modes. _handControl.update(_mouseX, _mouseY); - _myAvatar.setHandMovementValues(_handControl.getValues()); + _myAvatar.setMovedHandOffset(_handControl.getValues()); } // tell my avatar if the mouse is being pressed... diff --git a/interface/src/Avatar.cpp b/interface/src/Avatar.cpp index 704deaf9fe..9b351a7684 100644 --- a/interface/src/Avatar.cpp +++ b/interface/src/Avatar.cpp @@ -551,10 +551,6 @@ void Avatar::updateHandMovementAndTouching(float deltaTime) { } } -float Avatar::getHeight() { - return _height; -} - void Avatar::updateCollisionWithSphere(glm::vec3 position, float radius, float deltaTime) { float myBodyApproximateBoundingRadius = 1.0f; glm::vec3 vectorFromMyBodyToBigSphere(_position - position); @@ -780,16 +776,6 @@ void Avatar::render(bool lookingInMirror, glm::vec3 cameraPosition) { } } - - -void Avatar::setHandMovementValues(glm::vec3 handOffset) { - _movedHandOffset = handOffset; -} - -AvatarMode Avatar::getMode() { - return _mode; -} - void Avatar::initializeSkeleton() { for (int b=0; b Date: Fri, 17 May 2013 12:27:05 -0700 Subject: [PATCH 6/9] disallow copying for AudioRingBuffer objects --- libraries/audio/src/AudioRingBuffer.cpp | 18 ------------------ libraries/audio/src/AudioRingBuffer.h | 6 ++++-- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/libraries/audio/src/AudioRingBuffer.cpp b/libraries/audio/src/AudioRingBuffer.cpp index 746ff523f8..19fea1593a 100644 --- a/libraries/audio/src/AudioRingBuffer.cpp +++ b/libraries/audio/src/AudioRingBuffer.cpp @@ -24,28 +24,10 @@ AudioRingBuffer::AudioRingBuffer(int ringSamples, int bufferSamples) : _nextOutput = _buffer; }; -AudioRingBuffer::AudioRingBuffer(const AudioRingBuffer &otherRingBuffer) { - _ringBufferLengthSamples = otherRingBuffer._ringBufferLengthSamples; - _bufferLengthSamples = otherRingBuffer._bufferLengthSamples; - _started = otherRingBuffer._started; - _shouldBeAddedToMix = otherRingBuffer._shouldBeAddedToMix; - _shouldLoopbackForAgent = otherRingBuffer._shouldLoopbackForAgent; - - _buffer = new int16_t[_ringBufferLengthSamples]; - memcpy(_buffer, otherRingBuffer._buffer, sizeof(int16_t) * _ringBufferLengthSamples); - - _nextOutput = _buffer + (otherRingBuffer._nextOutput - otherRingBuffer._buffer); - _endOfLastWrite = _buffer + (otherRingBuffer._endOfLastWrite - otherRingBuffer._buffer); -} - AudioRingBuffer::~AudioRingBuffer() { delete[] _buffer; }; -AudioRingBuffer* AudioRingBuffer::clone() const { - return new AudioRingBuffer(*this); -} - const int AGENT_LOOPBACK_MODIFIER = 307; int AudioRingBuffer::parseData(unsigned char* sourceBuffer, int numBytes) { diff --git a/libraries/audio/src/AudioRingBuffer.h b/libraries/audio/src/AudioRingBuffer.h index fb739629c9..68c35937a7 100644 --- a/libraries/audio/src/AudioRingBuffer.h +++ b/libraries/audio/src/AudioRingBuffer.h @@ -22,10 +22,8 @@ class AudioRingBuffer : public AgentData { public: AudioRingBuffer(int ringSamples, int bufferSamples); ~AudioRingBuffer(); - AudioRingBuffer(const AudioRingBuffer &otherRingBuffer); int parseData(unsigned char* sourceBuffer, int numBytes); - AudioRingBuffer* clone() const; int16_t* getNextOutput() const { return _nextOutput; } void setNextOutput(int16_t* nextOutput) { _nextOutput = nextOutput; } @@ -48,6 +46,10 @@ public: short diffLastWriteNextOutput(); private: + // disallow copying of AudioRingBuffer objects + AudioRingBuffer(const AudioRingBuffer&); + AudioRingBuffer& operator= (const AudioRingBuffer&); + int _ringBufferLengthSamples; int _bufferLengthSamples; Position _position; From c26a05ff9762368c6a4c5bb626316b6bf289a0be Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 17 May 2013 12:31:00 -0700 Subject: [PATCH 7/9] disallow copying of VoxelAgentData objects --- voxel-server/src/VoxelAgentData.cpp | 30 ++++++++++------------------- voxel-server/src/VoxelAgentData.h | 9 ++++----- 2 files changed, 14 insertions(+), 25 deletions(-) diff --git a/voxel-server/src/VoxelAgentData.cpp b/voxel-server/src/VoxelAgentData.cpp index 4eb971f275..e25defef7a 100644 --- a/voxel-server/src/VoxelAgentData.cpp +++ b/voxel-server/src/VoxelAgentData.cpp @@ -11,19 +11,18 @@ #include #include -VoxelAgentData::VoxelAgentData() { - init(); +VoxelAgentData::VoxelAgentData() : + _viewSent(false), + _voxelPacketAvailableBytes(MAX_VOXEL_PACKET_SIZE), + _maxSearchLevel(1), + _maxLevelReachedInLastSearch(1) +{ + _voxelPacket = new unsigned char[MAX_VOXEL_PACKET_SIZE]; + _voxelPacketAt = _voxelPacket; + + resetVoxelPacket(); } -void VoxelAgentData::init() { - _voxelPacket = new unsigned char[MAX_VOXEL_PACKET_SIZE]; - _voxelPacketAvailableBytes = MAX_VOXEL_PACKET_SIZE; - _voxelPacketAt = _voxelPacket; - _maxSearchLevel = 1; - _maxLevelReachedInLastSearch = 1; - resetVoxelPacket(); - _viewSent = false; -} void VoxelAgentData::resetVoxelPacket() { _voxelPacket[0] = getWantColor() ? PACKET_HEADER_VOXEL_DATA : PACKET_HEADER_VOXEL_DATA_MONOCHROME; @@ -43,15 +42,6 @@ VoxelAgentData::~VoxelAgentData() { delete[] _voxelPacket; } -VoxelAgentData::VoxelAgentData(const VoxelAgentData &otherAgentData) { - memcpy(&_position, &otherAgentData._position, sizeof(_position)); - init(); -} - -VoxelAgentData* VoxelAgentData::clone() const { - return new VoxelAgentData(*this); -} - bool VoxelAgentData::updateCurrentViewFrustum() { bool currentViewFrustumChanged = false; ViewFrustum newestViewFrustum; diff --git a/voxel-server/src/VoxelAgentData.h b/voxel-server/src/VoxelAgentData.h index 99be7e6042..fbf5f12d3d 100644 --- a/voxel-server/src/VoxelAgentData.h +++ b/voxel-server/src/VoxelAgentData.h @@ -19,11 +19,7 @@ class VoxelAgentData : public AvatarData { public: VoxelAgentData(); ~VoxelAgentData(); - VoxelAgentData(const VoxelAgentData &otherAgentData); - - VoxelAgentData* clone() const; - void init(); // sets up data internals void resetVoxelPacket(); // resets voxel packet to after "V" header void writeToPacket(unsigned char* buffer, int bytes); // writes to end of packet @@ -52,7 +48,10 @@ public: bool getViewSent() const { return _viewSent; }; void setViewSent(bool viewSent) { _viewSent = viewSent; } -private: +private: + VoxelAgentData(const VoxelAgentData &); + VoxelAgentData& operator= (const VoxelAgentData&); + bool _viewSent; unsigned char* _voxelPacket; unsigned char* _voxelPacketAt; From 7e766eb35161569b2e1ce053a313a168674fcf2b Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 17 May 2013 12:31:16 -0700 Subject: [PATCH 8/9] fix eve's use of the now disallowed copy constructor --- eve/src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eve/src/main.cpp b/eve/src/main.cpp index 52f307c18f..b03a0b567a 100644 --- a/eve/src/main.cpp +++ b/eve/src/main.cpp @@ -93,7 +93,7 @@ int main(int argc, const char* argv[]) { pthread_create(&receiveAgentDataThread, NULL, receiveAgentData, NULL); // create an AvatarData object, "eve" - AvatarData eve = AvatarData(); + AvatarData eve; // move eve away from the origin // pick a random point inside a 10x10 grid From fc0448a148b3f09deb6188ac4debe0b2d5c5e8ac Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 17 May 2013 12:32:42 -0700 Subject: [PATCH 9/9] disallow copying of VoxelSystem objects --- interface/src/VoxelSystem.cpp | 5 ----- interface/src/VoxelSystem.h | 5 ++++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/interface/src/VoxelSystem.cpp b/interface/src/VoxelSystem.cpp index ac74d81c7f..a3796f68c1 100644 --- a/interface/src/VoxelSystem.cpp +++ b/interface/src/VoxelSystem.cpp @@ -417,11 +417,6 @@ int VoxelSystem::updateNodeInArraysAsPartialVBO(VoxelNode* node) { return 0; // not-updated } -VoxelSystem* VoxelSystem::clone() const { - // this still needs to be implemented, will need to be used if VoxelSystem is attached to agent - return NULL; -} - void VoxelSystem::init() { _renderWarningsOn = false; diff --git a/interface/src/VoxelSystem.h b/interface/src/VoxelSystem.h index a3560c1b31..2d6d9717f6 100644 --- a/interface/src/VoxelSystem.h +++ b/interface/src/VoxelSystem.h @@ -31,7 +31,6 @@ public: ~VoxelSystem(); int parseData(unsigned char* sourceBuffer, int numBytes); - VoxelSystem* clone() const; void setViewFrustum(ViewFrustum* viewFrustum) { _viewFrustum = viewFrustum; }; @@ -82,6 +81,10 @@ public: creationMode mode, bool destructive = false, bool debug = false); private: + // disallow copying of VoxelSystem objects + VoxelSystem(const VoxelSystem&); + VoxelSystem& operator= (const VoxelSystem&); + int _callsToTreesToArrays; VoxelNodeBag _removedVoxels;