PageRenderTime 27ms CodeModel.GetById 9ms app.highlight 13ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llmessage/mean_collision_data.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 96 lines | 60 code | 10 blank | 26 comment | 0 complexity | a62121a6fa3e853346622ed581ac43de MD5 | raw file
 1/** 
 2 * @file mean_collision_data.h
 3 * @brief data type to log interactions between stuff and agents that
 4 * might be community standards violations
 5 *
 6 * $LicenseInfo:firstyear=2000&license=viewerlgpl$
 7 * Second Life Viewer Source Code
 8 * Copyright (C) 2010, Linden Research, Inc.
 9 * 
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation;
13 * version 2.1 of the License only.
14 * 
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 * Lesser General Public License for more details.
19 * 
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
23 * 
24 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
25 * $/LicenseInfo$
26 */
27
28#ifndef LL_MEAN_COLLISIONS_DATA_H
29#define LL_MEAN_COLLISIONS_DATA_H
30
31#include "lldbstrings.h"
32#include "lluuid.h"
33
34const F32 MEAN_COLLISION_TIMEOUT = 5.f;
35const S32 MAX_MEAN_COLLISIONS = 5;
36
37typedef enum e_mean_collision_types
38{
39	MEAN_INVALID,
40	MEAN_BUMP,
41	MEAN_LLPUSHOBJECT,
42	MEAN_SELECTED_OBJECT_COLLIDE,
43	MEAN_SCRIPTED_OBJECT_COLLIDE,
44	MEAN_PHYSICAL_OBJECT_COLLIDE,
45	MEAN_EOF
46} EMeanCollisionType;
47
48class LLMeanCollisionData
49{
50public:
51	LLMeanCollisionData(const LLUUID &victim, const LLUUID &perp, time_t time, EMeanCollisionType type, F32 mag)
52		: mVictim(victim), mPerp(perp), mTime(time), mType(type), mMag(mag)
53	{
54	}
55	
56	LLMeanCollisionData(LLMeanCollisionData *mcd)
57		: mVictim(mcd->mVictim), mPerp(mcd->mPerp), mTime(mcd->mTime), mType(mcd->mType), mMag(mcd->mMag),
58		  mFullName(mcd->mFullName)
59	{
60	}		
61	
62	friend std::ostream&	 operator<<(std::ostream& s, const LLMeanCollisionData &a)
63	{
64		switch(a.mType)
65		{
66		case MEAN_BUMP:
67			s << "Mean Collision: " << a.mPerp << " bumped " << a.mVictim << " with a velocity of " << a.mMag << " at " << ctime(&a.mTime);
68			break;
69		case MEAN_LLPUSHOBJECT:
70			s << "Mean Collision: " << a.mPerp << " llPushObject-ed " << a.mVictim << " with a total force of " << a.mMag  << " at "<<  ctime(&a.mTime);
71			break;
72		case MEAN_SELECTED_OBJECT_COLLIDE:
73			s << "Mean Collision: " << a.mPerp << " dragged an object into " << a.mVictim << " with a velocity of " << a.mMag  << " at "<<  ctime(&a.mTime);
74			break;
75		case MEAN_SCRIPTED_OBJECT_COLLIDE:
76			s << "Mean Collision: " << a.mPerp << " smacked " << a.mVictim << " with a scripted object with velocity of " << a.mMag  << " at "<<  ctime(&a.mTime);
77			break;
78		case MEAN_PHYSICAL_OBJECT_COLLIDE:
79			s << "Mean Collision: " << a.mPerp << " smacked " << a.mVictim << " with a physical object with velocity of " << a.mMag  << " at "<<  ctime(&a.mTime);
80			break;
81		default:
82			break;
83		}
84		return s;
85	}
86
87	LLUUID mVictim;
88	LLUUID mPerp;
89	time_t mTime;
90	EMeanCollisionType mType;
91	F32	   mMag;
92	std::string mFullName;
93};
94
95
96#endif