////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// This is a part of the COM Serialization SDK VC++ Library.
//  
// Copyright 2009 BPM Microsystems
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//                                                                                                                    //
// $Header: //sesca/src/Winprog/COMSerializationSDK/VC++/HeaderLib/ComSerSdk/rcs/StaticVector.h 1.1 2009/02/03 15:01:13 arturoc Exp $
//                                                                                                                    //
///////// 120 columns, Tab = Insert 3 Spaces ///////////////////////////////////////////////////////////////////////////

/**
   This header file defines the CStaticVector class.
*/
#pragma once

#include <sstream>
#include "Detail\Vector.h"
#include "ScriptingRuntime.h"
#include "Exception.h"

namespace ComSerSdk
{

namespace Detail
{
   /**
      So that the CStaticVector class can declare it as a friend.
   */
   template<class TVector, class TBase>
   class CSvsi;

   template<class TVector, class TBase>
   class CSSocketVsi;
}// end namespace Detail

/**
   Type of vector used by the library-user when they want to define a static vector server class.
   Consult the COM Serialization SDK documentation for details.
*/
template<unsigned long long ullAddr, unsigned uSize>
class CStaticVector : public Detail::CVectorBase
{
public:

   /**
      Provided so that, at compile-time, the library user has access to the data pattern address he/she configured this
      vector with.
   */
   static const unsigned long long k_ullAddr = ullAddr;
   
   /**
      Provided so that, at compile-time, the library user has access to the value that represents the number of data
      pattern bytes to modify with this vector.
   */
   static const unsigned k_uSize = uSize;

private:

   // only CSvsi can instantiate us
   template<class TVector, class TBase>
   friend class Detail::CSvsi;

   template<class TVector, class TBase>
   friend class Detail::CSSocketVsi;
   /**
      At runtime, forwards vector configuration functionality to the base class, using the runtime arguments supplied
      to this ctor, as well as the compile-time arguments supplied as class template parameters.
   */
   CStaticVector(Scripting::IDictionaryPtr & spoDictionary,
                 Detail::CExceptionPtr & spoVectorDestructorException):
      Detail::CVectorBase(k_ullAddr, k_uSize, spoDictionary, spoVectorDestructorException)
   {}

};
}// end namespace ComSerSdk