Esempio n. 1
0
 void CameraBuffer::setParameter(const unsigned int id, const Data& value)
 {
     try
     {
         switch(id)
         {
         case BUFFER_SIZE:
             m_bufferSize = stromx::runtime::data_cast<UInt32>(value);
             break;
         case NUM_BUFFERS:
         {
             UInt32 newNumBuffers = stromx::runtime::data_cast<UInt32>(value);
             if(newNumBuffers < 1)
                 throw WrongParameterValue(parameter(NUM_BUFFERS), *this);
             m_numBuffers = newNumBuffers;
             break;
         }
         default:
             throw WrongParameterId(id, *this);
         }
     }
     catch(std::bad_cast&)
     {
         throw WrongParameterType(parameter(id), *this);
     }
 }
Esempio n. 2
0
 void ReadDirectory::setParameter(unsigned int id, const Data& value)
 {
     Enum enumValue;
     try
     {
         switch(id)
         {
         case DIRECTORY:
             enumValue = data_cast<Enum>(value);
             
             if (m_directory != NO_DIRECTORY)
             {
                 if(m_directoryMap.count(std::size_t(enumValue)) == 0)
                     throw WrongParameterValue(parameter(id), *this);
             }
             m_directory = enumValue;
             break;
         default:
             throw WrongParameterId(id, *this);
         }
     }
     catch(std::bad_cast&)
     {
         throw WrongParameterType(parameter(id), *this);
     }
 }
Esempio n. 3
0
 void Send::setParameter(unsigned int id, const runtime::Data& value)
 {
     UInt16 uintValue;
     
     switch(id)
     {
     case PORT:
         uintValue = data_cast<UInt16>(value);
         if(uintValue < MIN_PORT)
             throw WrongParameterValue(parameter(PORT), *this, "Too small port number.");
         if(uintValue > MAX_PORT)
             throw WrongParameterValue(parameter(PORT), *this, "Too large port number.");
         m_port = uintValue;
         break;
     default:
         throw WrongParameterId(id, *this);
     }
 }