Skip to search.
tlb2h · Discussion on the Comet library for C++ COM development.

Group Information

  • Members: 81
  • Founded: Dec 12, 2000
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Messages

  Messages Help
Advanced
Implement class factory   Message List  
Reply Message #1073 of 1073 | Next >
Implement class factory

What is the best way to implement a custom class object using comet (i.e.
one that is not an implementation of IClassFactory)?

I'm trying to implement the IParseDisplayName interface which takes the
place of IClassFactory to return object instances by name. In other
words, this must be implemented by the class object rather than the
instances. What is the best to do this using comet?

I've tried the following code but I get an ambigious conversion error "
error C2594: 'return' : ambiguous conversions from
'coclass_implementation<RealDispenser> *' to 'IUnknown *' see
comet\server.h:1349". The comment above this line of server.h warns that
this might happen if the class factory implements more than one interface.
The one below does. Can we change the server.h code to use a proper
QueryInterface call?

Many thanks.

Alex


namespace comet {

/**
* A coclass variant that allows implementing from non-comet
* implementation classes.
*/
template<
typename T, typename U,
enum thread_model::thread_model_t TM = thread_model::Apartment,
COMET_LIST_TEMPLATE>
struct ATL_NO_VTABLE custom_coclass :
public impl::simple_object_aux<
typelist::append<
typename make_list<COMET_LIST_ARG_1>::result,
typename make_list<IProvideClassInfoImpl<T>
>::result > >
{
typedef custom_coclass coclass_type;
enum { factory_type = impl::ft_standard };
enum { thread_model = TM };
static const TCHAR* get_progid() { return 0; }
};

enum my_factory_type_t { ft_static = 10 };

namespace impl {

/**
* A factory builder that uses the class itself as the factory rather
* than a default implementation of IClassFactory.
*/
template<typename CLASS, bool LOCK_MODULE>
struct factory_builder_aux<ft_static, CLASS, LOCK_MODULE>
{
typedef CLASS is_factory;
};

} // namespace impl
} // namespace comet

template<>
class coclass_implementation<RealDispenser> :
public comet::custom_coclass<
RealDispenser, swish::provider::dispenser::CDispenser,
comet::thread_model::Both>
{
public:
enum { factory_type = ft_static };
};






Thu Dec 24, 2009 11:18 pm

awl03@...
Send Email Send Email

Message #1073 of 1073 | Next >
Expand Messages Author Sort by Date

What is the best way to implement a custom class object using comet (i.e. one that is not an implementation of IClassFactory)? I'm trying to implement the...
Alexander Lamaison
awl03@... Send Email
Dec 25, 2009
4:54 am

What is the best way to implement a custom class object using comet (i.e. one that is not an implementation of IClassFactory)? I'm trying to implement the...
Alexander Lamaison
awl03@... Send Email
Dec 25, 2009
4:55 am
< Prev Topic  |  Next Topic >
Advanced

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help