////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 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/Atl.h 1.1 2009/02/03 15:01:01 arturoc Exp $
//                                                                                                                    //
///////// 120 columns, Tab = Insert 3 Spaces ///////////////////////////////////////////////////////////////////////////

/**
   This header file:
   a.) includes important components of the Microsoft ATL library
   b.) defines code that deals with the ATL library in a general fashion
   both of those things are used throughout the ComSerSdk library implementation.

   If you use the ComSerSdk library in a VC++ project where there is a precompiled header, we recommend you include
   this file in that header.
*/

#pragma once

/**
   This enables the use of C++ attributes to generate extra COM-specific code with the VC++ compiler.
*/
#define _ATL_ATTRIBUTES

/**
   COM requires us to decide on a "threading model", so we've chosen to use the most common of them.
   See "Single-Thread Apartments" in MSDN for a thorough explanation.
*/
#define _ATL_APARTMENT_THREADED

#include <atlbase.h>
#include <atlcom.h>
#include <atlsafe.h>

#include <ostream>
#include <comdef.h>
#include <comutil.h>

namespace ComSerSdk
{
namespace Detail
{

/**
   Defined so that, throughout the library implementation, we may conveniently insert VARIANTs into iostream objects,
   utilizing VARIANT's built-in functionality of coersion to string.
*/
template<typename Elem, typename Traits>
inline std::basic_ostream<Elem, Traits> & operator << (std::basic_ostream<Elem, Traits> & oBasicOstream, 
                                                       const _variant_t & oVariant)
{	
   return oBasicOstream << static_cast<const char *>(static_cast<_bstr_t>(oVariant));
}
}
}