variantchangetype problems COM interoperability C++/CLI

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nabil035
    New Member
    • Mar 2008
    • 34

    variantchangetype problems COM interoperability C++/CLI

    hi,

    I'm writing a wrapper from unmanaged C++ to C++/CLI

    I've replaced the variant_type by
    a structure:
    Type_Value
    {
    SupportedTypes Type,
    String^ Value
    }
    Supported_Types //enm type
    {
    types written in hand
    }

    well, this is working very good and this is suitable for me
    but now I need the results of variantchangety pe cuz I'm developping an OPC server and this is the general method to use

    I have many ideas but I want to hear from you experts if there's any solution or other ways to wrap variant types

    thx in advance.
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    Let's call this by it;s real name: a typecast.

    You typecast in C++ if a) you are calling a relic C function, or b) your C++ design is screwed up.

    Your C++ object should be able to change it's type by a) implementing the State design pattern, or b) using conversion operators.

    Not knowing your situation, I don't know which is better.

    Comment

    • nabil035
      New Member
      • Mar 2008
      • 34

      #3
      thx can u give me an idea about this State Pattern or give me a useful link.

      Comment

      • Banfa
        Recognized Expert Expert
        • Feb 2006
        • 9067

        #4
        State Design Pattern

        Comment

        Working...