Changeset 10197 for code/trunk/src
- Timestamp:
- Jan 17, 2015, 6:43:35 PM (10 years ago)
- Location:
- code/trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/libraries/util/MultiType.h
r9550 r10197 348 348 inline bool null() const { return !this->value_; } 349 349 350 inline operator char() const { return (this->value_ ? this->value_->get<char>() : 0); } 351 inline operator unsigned char() const { return (this->value_ ? this->value_->get<unsigned char>() : 0); } 352 inline operator short() const { return (this->value_ ? this->value_->get<short>() : 0); } 353 inline operator unsigned short() const { return (this->value_ ? this->value_->get<unsigned short>() : 0); } 354 inline operator int() const { return (this->value_ ? this->value_->get<int>() : 0); } 355 inline operator unsigned int() const { return (this->value_ ? this->value_->get<unsigned int>() : 0); } 356 inline operator long() const { return (this->value_ ? this->value_->get<long>() : 0); } 357 inline operator unsigned long() const { return (this->value_ ? this->value_->get<unsigned long>() : 0); } 358 inline operator long long() const { return (this->value_ ? this->value_->get<long long>() : 0); } 359 inline operator unsigned long long() const { return (this->value_ ? this->value_->get<unsigned long long>() : 0); } 360 inline operator float() const { return (this->value_ ? this->value_->get<float>() : 0); } 361 inline operator double() const { return (this->value_ ? this->value_->get<double>() : 0); } 362 inline operator long double() const { return (this->value_ ? this->value_->get<long double>() : 0); } 363 inline operator bool() const { return (this->value_ ? this->value_->get<bool>() : 0); } 364 inline operator void*() const { return (this->value_ ? this->value_->get<void*>() : 0); } 365 inline operator std::string() const { return (this->value_ ? this->value_->get<std::string>() : NilValue<std::string>()); } 366 inline operator orxonox::Vector2() const { return (this->value_ ? this->value_->get<orxonox::Vector2>() : NilValue<orxonox::Vector2>()); } 367 inline operator orxonox::Vector3() const { return (this->value_ ? this->value_->get<orxonox::Vector3>() : NilValue<orxonox::Vector3>()); } 368 inline operator orxonox::Vector4() const { return (this->value_ ? this->value_->get<orxonox::Vector4>() : NilValue<orxonox::Vector4>()); } 369 inline operator orxonox::ColourValue() const { return (this->value_ ? this->value_->get<orxonox::ColourValue>() : NilValue<orxonox::ColourValue>()); } 370 inline operator orxonox::Quaternion() const { return (this->value_ ? this->value_->get<orxonox::Quaternion>() : NilValue<orxonox::Quaternion>()); } 371 inline operator orxonox::Radian() const { return (this->value_ ? this->value_->get<orxonox::Radian>() : NilValue<orxonox::Radian>()); } 372 inline operator orxonox::Degree() const { return (this->value_ ? this->value_->get<orxonox::Degree>() : NilValue<orxonox::Degree>()); } 373 /// Returns the current value, converted to a T* pointer. 374 template <class T> operator T*() const { return (static_cast<T*>(this->operator void*())); } 350 /// Conversion operator for all types 351 template <class T> operator T() const { return this->get<T>(); } 375 352 376 353 /// Assigns the value to the given pointer. The value gets converted if the types don't match. 377 354 template <typename T> inline bool getValue(T* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } 378 355 379 /// Returns the current value, converted to the requested type. 380 template <typename T> inline T get() const { return *this; } 356 /// Returns the current value, converted to the requested type. This base implementation works only for pointers. All other supported types are 357 /// implemented in specialized functions at the bottom of this file. 358 template <typename T> inline T get() const { return static_cast<T>(this->get<void*>()); } 381 359 382 360 … … 493 471 template <> inline bool MultiType::isType<void>() const { return this->null(); } 494 472 template <> inline bool MultiType::convert<void>() { this->reset(); return true; } 473 474 template <> inline char MultiType::get() const { return (this->value_ ? this->value_->get<char>() : 0); } 475 template <> inline unsigned char MultiType::get() const { return (this->value_ ? this->value_->get<unsigned char>() : 0); } 476 template <> inline short MultiType::get() const { return (this->value_ ? this->value_->get<short>() : 0); } 477 template <> inline unsigned short MultiType::get() const { return (this->value_ ? this->value_->get<unsigned short>() : 0); } 478 template <> inline int MultiType::get() const { return (this->value_ ? this->value_->get<int>() : 0); } 479 template <> inline unsigned int MultiType::get() const { return (this->value_ ? this->value_->get<unsigned int>() : 0); } 480 template <> inline long MultiType::get() const { return (this->value_ ? this->value_->get<long>() : 0); } 481 template <> inline unsigned long MultiType::get() const { return (this->value_ ? this->value_->get<unsigned long>() : 0); } 482 template <> inline long long MultiType::get() const { return (this->value_ ? this->value_->get<long long>() : 0); } 483 template <> inline unsigned long long MultiType::get() const { return (this->value_ ? this->value_->get<unsigned long long>() : 0); } 484 template <> inline float MultiType::get() const { return (this->value_ ? this->value_->get<float>() : 0); } 485 template <> inline double MultiType::get() const { return (this->value_ ? this->value_->get<double>() : 0); } 486 template <> inline long double MultiType::get() const { return (this->value_ ? this->value_->get<long double>() : 0); } 487 template <> inline bool MultiType::get() const { return (this->value_ ? this->value_->get<bool>() : 0); } 488 template <> inline void* MultiType::get() const { return (this->value_ ? this->value_->get<void*>() : 0); } 489 template <> inline std::string MultiType::get() const { return (this->value_ ? this->value_->get<std::string>() : NilValue<std::string>()); } 490 template <> inline orxonox::Vector2 MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::Vector2>() : NilValue<orxonox::Vector2>()); } 491 template <> inline orxonox::Vector3 MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::Vector3>() : NilValue<orxonox::Vector3>()); } 492 template <> inline orxonox::Vector4 MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::Vector4>() : NilValue<orxonox::Vector4>()); } 493 template <> inline orxonox::ColourValue MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::ColourValue>() : NilValue<orxonox::ColourValue>()); } 494 template <> inline orxonox::Quaternion MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::Quaternion>() : NilValue<orxonox::Quaternion>()); } 495 template <> inline orxonox::Radian MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::Radian>() : NilValue<orxonox::Radian>()); } 496 template <> inline orxonox::Degree MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::Degree>() : NilValue<orxonox::Degree>()); } 495 497 496 498 template <> _UtilExport void MultiType::createNewValueContainer(const char& value); -
code/trunk/src/orxonox/gamestates/GSServer.cc
r9667 r10197 58 58 GameMode::setIsServer(true); 59 59 60 this->server_ = new Server(CommandLineParser::getValue("port") );60 this->server_ = new Server(CommandLineParser::getValue("port").get<int>()); 61 61 orxout(user_status) << "Loading scene in server mode" << endl; 62 62
Note: See TracChangeset
for help on using the changeset viewer.