instantiation

Using DirectShow filters outside DirectShow?

巧了我就是萌 提交于 2019-12-06 11:33:43
I'm currently dealing with Windows Media Foundation. However, due to some problems with the Microsoft H.264 decoder and some missing decoders for custom format, I'd like to know if it would be possible to instantiate a DirectShow Decoder directly using CLSID, and build a proxy around it that exposes IMFTransform to get a decoder for Media Foundation. So here is my question: Can i instantiate a Directshow filter (preferrably decoders) directly and use them for decoding (i.e. put some compressed frames and get uncompressed ones) to create a MFT? I know how to instantiate the filter itself using

R, R6, Get Full Class Name from R6Generator Object

丶灬走出姿态 提交于 2019-12-06 09:23:21
In R6, How can I get the full list of class inheritances, without creating instances of the generator objects? Consider the following: A = R6::R6Class("Base",NULL) B = R6::R6Class("Top",inherit = A) class(B) #Returns 'R6ClassGenerator' B$classname #Returns 'Top' What I want is c('Top','Base','R6') In other words, what would otherwise be returned by class(B$new()) In the real world, I have a complex set of inheritances, and, initializers with many arguments, some without default values, so I am trying to avoid instantiating a new object in order to obtain this information. There isn't a built

instantiating a new class in a loop or not in a loop?

旧巷老猫 提交于 2019-12-06 08:10:54
问题 require_once('Class.php'); $myArray = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15); // etc which is correct? foreach($myArray as $key => $val) { $class = new Class(); $result = $class->someMethod($val); } or $class = new Class(); foreach($myArray as $key => $val) { $result = $class->someMethod($val); } Edited to be more specific, using http://simplepie.org/wiki/reference/simplepie/get_items $aFeeds = array(rssFeed1,rssFeed2,rssFeed3,...); foreach($aFeeds as $key => $feedURL) { $feed->set_feed

Why can't I instantiate a generic class inferring types from anonymous objects?

倖福魔咒の 提交于 2019-12-06 07:53:44
Let's say I have some class - hypothetical example: public class InvalidResponseException<TReq, TResp> : Exception { public TReq RequestData { get; protected set; } public TResp ResponseData { get; protected set; } public InvalidResponseException(string message, TReq requestData, TResp responseData) : this(message, null, requestData, responseData) { } public InvalidResponseException(string message, Exception innerException, TReq requestData, TResp responseData) : base(message, innerException) { RequestData = requestData; ResponseData = responseData; } } Okay, class defined... and compiles, no

Can I use decltype (or something similar) for explicit template instantiation without signature duplication?

ぐ巨炮叔叔 提交于 2019-12-06 06:57:34
问题 I want to instantiate template<typename T> void foo( T& t, SomeType some_parameter, AnotherType another_parameter, EtcType yet_another_parameter, AsYouCanTell this_is_a_very_long_signature); that is, a function with a long signature. Now, I know how to do this: template void foo<int>( int& t, SomeType some_parameter, AnotherType another_parameter, EtcType yet_another_parameter, AsYouCanTell this_is_a_very_long_signature); But I have to duplicate the signature. Also, what if want specific

How to instantiate interface in fragment?

半城伤御伤魂 提交于 2019-12-06 05:26:20
In my Android application, I have a fragment activity which it has a progressbar. This progress bar set to visible when any fragment invoke the interface. Therefore, the code for fragment class is like this: public class MainScreen extends FragmentActivity { public interface OnConnectingToInternet { public void showProgressbar(boolean flag); } // rest of codes . . . // Implementing Interface public void showProgressbar(boolean flag) { if(flag){ myProgressbar.showProgressBar(); } else { myProgressbar.hideProgressBar(); } } } Each fragment should connect to Internet and get data, however before

gcc problem with explicit template instantiation?

拟墨画扇 提交于 2019-12-06 05:21:02
It is my understanding that either a declaration or typedef of a specialization ought to cause a template class to be instantiated, but this does not appear to be happening with gcc. E.g. I have a template class, template class Foo {}; I write class Foo<double>; or typedef Foo<double> DoubleFoo; but after compilation the symbol table of the resulting object file does not contain the members of Foo. If I create an instance : Foo<double> aFoo; then of course the symbols are all generated. Has anyone else experienced this and/or have an explanation? The syntax for explicit instantiation is

difference between server.createObject and createobject in asp classic

时间秒杀一切 提交于 2019-12-06 04:47:25
问题 according to http://msdn.microsoft.com/en-us/library/ms524620.aspx you should use server.createObject If you are already familiar with VBScript or JScript, note that you do not use the scripting language's function for creating a new object instance (CreateObject in VBScript or New in JScript). You must use the ASP Server.CreateObject method; otherwise, ASP cannot track your use of the object in your scripts. but some other folks think that server.createObject implies an overhead that most

Stop C++ Class Instantiation

元气小坏坏 提交于 2019-12-06 02:07:09
Is there a way to stop a C++ class if there is an error in the instantiation? Like, return NULL maybe? Basically I have a wrapper class for MySQL, and the constructor does the connecting, but if the connection fails, I want the object to be, um, useless? PDB::PDB(string _DB_IP, string _DB_USER, string _DB_PASS, string _DB_DB) : _DB_IP( _DB_IP ), _DB_USER( _DB_USER ), _DB_PASS( _DB_PASS ), _DB_DB( _DB_DB ) { mysql_init(&this->mysql); this->connection = mysql_real_connect(&this->mysql, this->_DB_IP.c_str(), this->_DB_USER.c_str(), this->_DB_PASS.c_str(), this->_DB_DB.c_str(), 0, 0, 0); if( this-

Java array substring

大憨熊 提交于 2019-12-05 20:13:43
问题 How can I create/instantiate an array to be equal to the substring of another array, where the size of the substring is unknown: int n; //some number derived somewhere else String[] grp = elements[i] to elements[i+n]; 回答1: Use Arrays.copyOfRange: public static <T> T[] copyOfRange(T[] original, int from, int to) Copies the specified range of the specified array into a new array. The initial index of the range ( from ) must lie between zero and original.length , inclusive. The value at original