本文整理汇总了C++中NS函数的典型用法代码示例。如果您正苦于以下问题:C++ NS函数的具体用法?C++ NS怎么用?C++ NS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NS函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetS0
void ANCFBeamBE2D::GetdPosdqT(const Vector2D& p_loc, Matrix& dpdqi)
{
//p = S(p.x,p.y,p.z)*q; d(p)/dq
dpdqi.SetSize(SOS(),Dim());
dpdqi.FillWithZeros();
//d = S + ...
for (int i = 1; i <= NS(); i++)
{
double s = GetS0(p_loc.X(), i);
dpdqi((i-1)*Dim()+1,1) = s;
dpdqi((i-1)*Dim()+2,2) = s;
}
if (p_loc.Y() != 0)
{
double y = p_loc.Y();
Vector2D rx = GetPosx2D(p_loc.X());
Vector2D n(-rx.X(), rx.Y());
n /= rx.Norm();
for (int i = 1; i <= NS(); i++)
{
double sx = GetS0x(p_loc.X(), i) * 2./GetLx();
//y/|n|*dn/dq
dpdqi((i-1)*Dim()+1,2) += y*sx;
dpdqi((i-1)*Dim()+2,1) += -y*sx;
//y*n/|n|*(r_x1*S_x1 + r_x2*S_x2)
dpdqi((i-1)*Dim()+1,1) += y*n.X()*(rx.X()*sx);
dpdqi((i-1)*Dim()+1,2) += y*n.Y()*(rx.X()*sx);
dpdqi((i-1)*Dim()+2,1) += y*n.X()*(rx.Y()*sx);
dpdqi((i-1)*Dim()+2,2) += y*n.Y()*(rx.Y()*sx);
}
}
};
开发者ID:AlexeySmolin,项目名称:LIGGGHTS-MCA,代码行数:34,代码来源:ANCFBeamBE2D.cpp
示例2: Tclmsgque_Init
/** \brief initialize the tclmsgque package
*
* The tclmsgque package is created and one new command "msgque"
* is added to the Tcl interpreter.
* \param[in] interp the current interpreter
* \return Tcl error-code
*/
TCLMQ_EXTERN int
Tclmsgque_Init (
Tcl_Interp * interp
)
{
// check for the reight tcl
if (Tcl_InitStubs (interp, "8.5", 0) == NULL) {
return TCL_ERROR;
}
// announce my package
TclErrorCheck (Tcl_PkgProvide (interp, "TclMsgque", LIBMSGQUE_VERSION));
// provide "msgque" as only public cammand of the package
Tcl_CreateObjCommand (interp, "tclmsgque", NS(MsgqueCmd), (ClientData) NULL,
(Tcl_CmdDeleteProc *) NULL);
// init libmsgque global data
if (MqInitGet() == NULL && Tcl_GetNameOfExecutable() != NULL) {
struct MqBufferLS * initB = MqInitCreate();
if (Tcl_Eval(interp, "info script") == TCL_ERROR)
return TCL_ERROR;
MqBufferLAppendC(initB, Tcl_GetNameOfExecutable());
MqBufferLAppendC(initB, Tcl_GetStringResult(interp));
}
// create the default-factory
if (!strcmp(MqFactoryDefaultIdent(),"libmsgque")) {
MqFactoryDefault("tclmsgque", NS(FactoryCreate), NULL, NULL, NS(FactoryDelete), NULL, NULL);
}
return TCL_OK;
}
开发者ID:BackupTheBerlios,项目名称:nhi1-svn,代码行数:42,代码来源:msgque_tcl.c
示例3: NS
static enum MqErrorE MQ_DECL NS(FactoryCreate) (
struct MqS * const tmpl,
enum MqFactoryE create,
MQ_PTR data,
struct MqS ** contextP
)
{
JNIEnv * env = NULL;
// get env
if (create == MQ_FACTORY_NEW_THREAD) {
JavaVMAttachArgs args = {JNI_VERSION_1_6, "libmsgque", NULL};
if ((*cached_jvm)->AttachCurrentThread(cached_jvm, (void**)&env, (void**)&args) != JNI_OK) {
return MqErrorC (tmpl, __func__, -1, "unable to 'AttachCurrentThread'");
}
} else {
env = ((JNIEnv*) tmpl->threadData);
}
// create new object
*contextP = XCONTEXT((*env)->CallObjectMethod(env, (jobject)tmpl->self, NS(MID_IFactory_Factory)));
if((*env)->ExceptionCheck(env) == JNI_TRUE) {
(*env)->CallVoidMethod(env, tmpl->self, NS(MID_MqS_ErrorSet), (*env)->ExceptionOccurred(env));
(*env)->ExceptionClear(env);
return MqErrorStack(tmpl);
}
MqConfigDup (*contextP, tmpl);
MqSetupDup (*contextP, tmpl);
return MQ_OK;
}
开发者ID:BackupTheBerlios,项目名称:nhi1-svn,代码行数:31,代码来源:context_java.c
示例4: type
/*! \internal
\since 4.7
Registers a user type for marshalling, as an alias of another type (typedef)
*/
int QMetaType::registerTypedef(const char* typeName, int aliasId)
{
QVector<QCustomTypeInfo> *ct = customTypes();
if (!ct || !typeName)
return -1;
#ifdef QT_NO_QOBJECT
NS(QByteArray) normalizedTypeName = typeName;
#else
NS(QByteArray) normalizedTypeName = QMetaObject::normalizedType(typeName);
#endif
int idx = qMetaTypeStaticType(normalizedTypeName.constData(),
normalizedTypeName.size());
if (idx) {
Q_ASSERT(idx == aliasId);
return idx;
}
QWriteLocker locker(customTypesLock());
idx = qMetaTypeCustomType_unlocked(normalizedTypeName.constData(),
normalizedTypeName.size());
if (idx)
return idx;
QCustomTypeInfo inf;
inf.typeName = normalizedTypeName;
inf.alias = aliasId;
inf.constr = 0;
inf.destr = 0;
ct->append(inf);
return aliasId;
}
开发者ID:jbartolozzi,项目名称:CIS462_HW1,代码行数:40,代码来源:qmetatype.cpp
示例5: TEST
TEST(StringTest, Case)
{
NoString x = NS("xx");
NoString X = NS("XX");
EXPECT_EQ(X, x.toUpper());
EXPECT_EQ(x, X.toLower());
}
开发者ID:Kriechi,项目名称:nobnc,代码行数:7,代码来源:StringTest.cpp
示例6: NS
static void
NS(test_main)(void *arg)
{
routerset_t *set = routerset_new();
smartlist_t *out = smartlist_new();
int r;
(void)arg;
NS_MOCK(nodelist_get_list);
smartlist_add(set->country_names, tor_strdup("{xx}"));
NS(mock_smartlist) = smartlist_new();
NS(mock_node).is_running = 0;
smartlist_add(NS(mock_smartlist), (void *)&NS(mock_node));
routerset_get_all_nodes(out, set, NULL, 1);
r = smartlist_len(out);
routerset_free(set);
smartlist_free(out);
smartlist_free(NS(mock_smartlist));
tt_int_op(r, ==, 0);
tt_int_op(CALLED(nodelist_get_list), ==, 1);
done:
;
}
开发者ID:caofangkun,项目名称:tor,代码行数:27,代码来源:test_routerset.c
示例7: calc_coefficients
static void calc_coefficients(AVFilterContext *ctx)
{
ColorMatrixContext *color = ctx->priv;
double rgb_coeffd[4][3][3];
double yuv_convertd[16][3][3];
int v = 0;
int i, j, k;
for (i = 0; i < 4; i++)
inverse3x3(rgb_coeffd[i], yuv_coeff[i]);
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
solve_coefficients(yuv_convertd[v], rgb_coeffd[i], yuv_coeff[j]);
for (k = 0; k < 3; k++) {
color->yuv_convert[v][k][0] = NS(yuv_convertd[v][k][0]);
color->yuv_convert[v][k][1] = NS(yuv_convertd[v][k][1]);
color->yuv_convert[v][k][2] = NS(yuv_convertd[v][k][2]);
}
if (color->yuv_convert[v][0][0] != 65536 || color->yuv_convert[v][1][0] != 0 ||
color->yuv_convert[v][2][0] != 0) {
av_log(ctx, AV_LOG_ERROR, "error calculating conversion coefficients\n");
}
v++;
}
}
}
开发者ID:ningyotoge,项目名称:FFmpeg,代码行数:26,代码来源:vf_colormatrix.c
示例8: customTypes
/*! \internal
Registers a user type for marshalling, with \a typeName, a \a
destructor, and a \a constructor. Returns the type's handle,
or -1 if the type could not be registered.
*/
int QMetaType::registerType(const char *typeName, Destructor destructor,
Constructor constructor)
{
QVector<QCustomTypeInfo> *ct = customTypes();
if (!ct || !typeName || !destructor || !constructor)
return -1;
#ifdef QT_NO_QOBJECT
NS(QByteArray) normalizedTypeName = typeName;
#else
NS(QByteArray) normalizedTypeName = QMetaObject::normalizedType(typeName);
#endif
int idx = qMetaTypeStaticType(normalizedTypeName.constData(),
normalizedTypeName.size());
if (!idx) {
QWriteLocker locker(customTypesLock());
idx = qMetaTypeCustomType_unlocked(normalizedTypeName.constData(),
normalizedTypeName.size());
if (!idx) {
QCustomTypeInfo inf;
inf.typeName = normalizedTypeName;
inf.constr = constructor;
inf.destr = destructor;
inf.alias = -1;
idx = ct->size() + User;
ct->append(inf);
}
}
return idx;
}
开发者ID:jbartolozzi,项目名称:CIS462_HW1,代码行数:38,代码来源:qmetatype.cpp
示例9: Init_rubymsgque
RUBYMQ_EXTERN void Init_rubymsgque() {
// Register system
#ifdef HAVE_FORK
// MqInitSysAPI(NS(fork),NULL);
#endif
// Initialize components
NS(MqS_Init)();
NS(MqSException_Init)();
NS(MqBufferS_Init)();
// get the script name
VALUE a0 = rb_gv_get("$0");
// init libmsgque global data
if (MqInitBuf == NULL && !NIL_P(a0)) {
struct MqBufferLS * initB = MqInitCreate();
MqBufferLAppendC(initB, VAL2CST(rb_argv0));
MqBufferLAppendC(initB, VAL2CST(a0));
}
// set global data
id_receiver = rb_intern("receiver");
id_clone = rb_intern("clone");
id_unbind = rb_intern("unbind");
id_bind = rb_intern("bind");
}
开发者ID:BackupTheBerlios,项目名称:nhi1-svn,代码行数:28,代码来源:context_ruby.c
示例10: NS
//! Restore the original environment
~environment ()
{
std::for_each (vars_set_.begin (), vars_set_.end (),
NS(bind) (&environment::unsetenv_, this, NSPH(_1)));
std::for_each (mod_vars_.begin (), mod_vars_.end (),
NS(bind) (&environment::setenv_, this, NSPH(_1)));
}
开发者ID:sirjaren,项目名称:utsushi,代码行数:8,代码来源:environment.hpp
示例11: NS
static or_state_t *
NS(get_or_state)(void)
{
NS(mock_state) = tor_malloc_zero(sizeof(or_state_t));
NS(mock_state)->AccountingBytesReadInInterval = 0;
NS(mock_state)->AccountingBytesWrittenInInterval = 0;
return NS(mock_state);
}
开发者ID:BwRy,项目名称:Astoria,代码行数:9,代码来源:test_status.c
示例12: NS
const node_t *
NS(node_get_by_nickname)(const char *nickname, int warn_if_unused)
{
CALLED(node_get_by_nickname)++;
tt_str_op(nickname, OP_EQ, NS(mock_nickname));
tt_int_op(warn_if_unused, OP_EQ, 1);
done:
return &NS(mock_node);
}
开发者ID:Archer-sys,项目名称:tor,代码行数:10,代码来源:test_routerset.c
示例13: NS
void NS(MqBufferS_Init) (TSRMLS_D) {
zend_class_entry me_ce;
// create class and make depend on "Exception"
INIT_CLASS_ENTRY(me_ce,"MqBufferS", NS(MqBufferS_functions));
NS(MqBufferS) = zend_register_internal_class(&me_ce TSRMLS_CC);
// define additional properties "buf" to save the "struct MqBufferS *" pointer
zend_declare_property_null(NS(MqBufferS), ID(__buf), ZEND_ACC_PRIVATE TSRMLS_CC);
}
开发者ID:BackupTheBerlios,项目名称:nhi1-svn,代码行数:10,代码来源:MqBufferS_php.c
示例14: NS
int NS(SendEND_AND_CALLBACK) (NS_ARGS)
{
SETUP_mqctx
MQ_STR token;
Tcl_Obj *callback;
CHECK_C(token)
CHECK_OBJ(callback)
CHECK_NOARGS
Tcl_IncrRefCount(callback);
ErrorMqToTclWithCheck(MqSendEND_AND_CALLBACK(mqctx, token, NS(ProcCall), callback, NS(ProcFree)));
RETURN_TCL
}
开发者ID:BackupTheBerlios,项目名称:nhi1-svn,代码行数:12,代码来源:send_tcl.c
示例15: NS
PyObject* NS(ReadForward) (
PyObject* self,
PyObject* args
)
{
SETUP_context
MqS_Obj *ctxO = NULL;
MqDumpS_Obj *dumpO = NULL;
PyErrorCheck (PyArg_ParseTuple(args, "O!|O!:ReadForward", &NS(MqS), &ctxO, &NS(MqDumpS), &dumpO));
ErrorMqToPythonWithCheck(MqReadForward(context, &ctxO->context, dumpO == NULL ? NULL : dumpO->dump));
SETUP_RETURN;
}
开发者ID:BackupTheBerlios,项目名称:nhi1-svn,代码行数:12,代码来源:read_python.c
示例16: NS
JNIEXPORT jobject JNICALL NS(ReadU) (
JNIEnv * env,
jobject self
)
{
SETUP_context;
MQ_BUF buffer;
ErrorMqToJavaWithCheck(MqReadU(context, &buffer));
return (*env)->NewObject(env, NS(Class_MqBufferS), NS(MID_MqBufferS_INIT), (jlong) buffer);
error:
return NULL;
}
开发者ID:BackupTheBerlios,项目名称:nhi1-svn,代码行数:12,代码来源:read_java.c
示例17: NS
void NS(MqDumpS_New) (
Tcl_Interp * interp,
struct MqDumpS * dump
)
{
char buffer[30];
sprintf(buffer, "<MqDumpS-%p>", dump);
Tcl_CreateObjCommand (interp, buffer, NS(MqDumpS_Cmd), dump, NS(MqDumpS_Free));
Tcl_SetResult (interp, buffer, TCL_VOLATILE);
Tcl_CreateExitHandler (NS(MqDumpS_Free), dump);
}
开发者ID:BackupTheBerlios,项目名称:nhi1-svn,代码行数:12,代码来源:MqDumpS_tcl.c
示例18: NS
int NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr, const char *name)
{
int i = getEncodingIndex(name);
if (i == UNKNOWN_ENC)
return 0;
INIT_ENC_INDEX(p) = (char)i;
p->initEnc.scanners[XML_PROLOG_STATE] = NS(initScanProlog);
p->initEnc.scanners[XML_CONTENT_STATE] = NS(initScanContent);
p->initEnc.updatePosition = initUpdatePosition;
p->encPtr = encPtr;
*encPtr = &(p->initEnc);
return 1;
}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:13,代码来源:xmltok_ns.c
示例19: NS
JNIEXPORT void JNICALL NS(ErrorSet) (
JNIEnv *env,
jobject self,
jthrowable ex
)
{
SETUP_context;
// is the EROOR from "java" or "javamsgque"
if ((*env)->IsInstanceOf(env, ex, NS(Class_MqSException))) {
// error is from "javamsgque"
const char *txtC = JO2C_START(
env, (jstring) (*env)->GetObjectField(env,ex,NS(FID_MqSException_txt))
);
MqErrorSet(context,
(MQ_INT) (*env)->GetIntField(env,ex,NS(FID_MqSException_num)),
(enum MqErrorE) (*env)->GetIntField(env,ex,NS(FID_MqSException_code)),
txtC
);
JO2C_STOP(env, ex, txtC);
} else {
// error is from "java"
jstring message = NULL;
// 1. if no "message" is available -> get StackTrace
//
// final Writer result = new StringWriter();
// final PrintWriter printWriter = new PrintWriter(result);
// ex.printStackTrace(printWriter);
// result.toString();
//
jobject stringWriter = (*env)->NewObject(env, NS(Class_StringWriter), NS(MID_StringWriter_INIT));
jobject printWriter = (*env)->NewObject(env, NS(Class_PrintWriter), NS(MID_PrintWriter_INIT), stringWriter);
(*env)->CallVoidMethod(env, ex, NS(MID_Throwable_printStackTrace), printWriter);
message = (jstring) (*env)->CallObjectMethod(env, stringWriter, NS(MID_StringWriter_toString));
// 2. Add java-error-message to MQ error
if (message != NULL) {
MQ_CST str = JO2C_START(env,message);
MqErrorC(context, __func__, -1, str);
JO2C_STOP(env,message,str);
} else {
MqErrorC(context, __func__, -1, "unknown Exception");
}
}
(*env)->ExceptionClear(env);
}
开发者ID:BackupTheBerlios,项目名称:nhi1-svn,代码行数:49,代码来源:error_java.c
示例20: action_admin_meta0_force
enum http_rc_e
action_admin_meta0_force(struct req_args_s *args)
{
GError *err = NULL;
GSList *m0_lst = NULL;
err = conscience_get_services(NS(), NAME_SRVTYPE_META0, FALSE, &m0_lst);
if (!err) {
for (GSList *l = m0_lst; l; l = l->next) {
g_clear_error(&err);
service_info_t *m0 = l->data;
gchar m0_url[STRLEN_ADDRINFO] = {0};
grid_addrinfo_to_string(&(m0->addr), m0_url, sizeof(m0_url));
err = meta0_remote_force(m0_url, (gchar*) args->rq->body->data);
if (!err) {
err = meta0_remote_cache_refresh(m0_url);
break;
} else if (!CODE_IS_NETWORK_ERROR(err->code)) {
break;
}
}
g_slist_free_full(m0_lst, (GDestroyNotify)service_info_clean);
}
if (err)
return _reply_common_error(args, err);
return _reply_nocontent(args);
}
开发者ID:cloudcache,项目名称:oio-sds,代码行数:29,代码来源:admin_actions.c
注:本文中的NS函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论